home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d2 / pwrbt14e.arc / POWERBAT.DOC < prev    next >
Text File  |  1990-12-01  |  126KB  |  2,626 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.                                         PowerBatch
  22.                                        Version 1.4
  23.  
  24.  
  25.  
  26.                               COMPUTING SYSTEMS DESIGN, INC.
  27.                                    6712 E. 102nd Street
  28.                                   Tulsa, Oklahoma 74133
  29.                                       (918) 299-8202
  30.  
  31.  
  32.                                    _______
  33.                               ____|__     |               (tm)
  34.                            --|       |    |-------------------
  35.                              |   ____|__  |  Association of
  36.                              |  |       |_|  Shareware
  37.                              |__|   o   |    Professionals
  38.                            -----|   |   |---------------------
  39.                                 |___|___|    MEMBER
  40.  
  41.  
  42.             CSD,  Inc.   is  a   member  of   The  Association  of   Shareware
  43.             Professionals and subscribes to  all the policies and standards of
  44.             this organization.
  45.  
  46.                            Copyright (c) 1989,1990 by CSD, Inc.
  47.                               All Rights Reserved Worldwide
  48.  
  49.                    This documentation was produced on December 6, 1990
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.                                     Table Of Contents
  58.  
  59.  
  60.            Introduction . . . . . . . . . . . . . . . . . . . . . . . . .    1
  61.  
  62.            Registration Fees And What You Get . . . . . . . . . . . . . .    3
  63.  
  64.            Software Support . . . . . . . . . . . . . . . . . . . . . . .    4
  65.  
  66.            Concept Of Operation . . . . . . . . . . . . . . . . . . . . .    5
  67.  
  68.            Installation . . . . . . . . . . . . . . . . . . . . . . . . .    7
  69.  
  70.            Constructing A PowerBatch Source File  . . . . . . . . . . . .    9
  71.  
  72.            PowerBatch Commands  . . . . . . . . . . . . . . . . . . . . .   10
  73.  
  74.            Command Summary  . . . . . . . . . . . . . . . . . . . . . . .   31
  75.  
  76.            Compilation Errors . . . . . . . . . . . . . . . . . . . . . .   33
  77.  
  78.            Removing PowerBatch From Your System . . . . . . . . . . . . .   35
  79.  
  80.            Examples . . . . . . . . . . . . . . . . . . . . . . . . . . .   36
  81.               DEMO1 . . . . . . . . . . . . . . . . . . . . . . . . . . .   36
  82.               MOVE1 . . . . . . . . . . . . . . . . . . . . . . . . . . .   42
  83.               MOVE2 . . . . . . . . . . . . . . . . . . . . . . . . . . .   43
  84.               MENU1 . . . . . . . . . . . . . . . . . . . . . . . . . . .   44
  85.               BOXDEMO2  . . . . . . . . . . . . . . . . . . . . . . . . .   45
  86.  
  87.            Index  . . . . . . . . . . . . . . . . . . . . . . . . . . . .   47
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.             Page 1                      PowerBatch                      Page 1
  96.  
  97.                                        Introduction
  98.  
  99.             PowerBatch  is a  Shareware product.  Shareware is  a distribution
  100.             method,  not  a  type of  software.  With  Shareware you  get  the
  101.             ultimate  money-back guarantee...if you don't use the product, you
  102.             don't pay for it.
  103.  
  104.             Shareware  is not  free  software. Copyright  laws  apply  to both
  105.             Shareware  and  commercial  software,  and  the  copyright  holder
  106.             retains  all rights,  with a few specific  exceptions as stated in
  107.             this  document.  Shareware authors  are accomplished  programmers,
  108.             just like commercial authors, and the  programs are of  comparable
  109.             quality.  (In  both cases,  you will  find good  programs and  bad
  110.             ones!)  The main difference is  in the method of distribution. The
  111.             author specifically grants  the right  to copy and distribute  the
  112.             EVALUATION  VERSION  of  the software  to  anyone  as long  as  no
  113.             remuneration  is  received for  the distribution  of the  software
  114.             unless permission is granted in writing by the author.
  115.  
  116.             Shareware  distribution  gives  users a  chance  to  try  software
  117.             before  buying it.  If you  try a  Shareware program  and continue
  118.             using  it,  you are  expected to  register the  software with  the
  119.             author.  With registration, you will receive the latest version of
  120.             the  software  without the  evaluation titles  and messages.  With
  121.             shareware you  are able to try the software on  your computer with
  122.             your  own set  of peripherals,  the only  way to  know if  it will
  123.             function  in your own  environment. After deciding that PowerBatch
  124.             is a  software product that  you will  use, then and only  then do
  125.             you  pay for it.  The ultimate trust from the  author! When you do
  126.             pay for  the software,  you pay  only for  the  software, not  for
  127.             advertisement  for the software which can cost many times what the
  128.             software actually costs.
  129.  
  130.             CSD,  Inc.  is   a  member   of  the   Association  of   Shareware
  131.             Professionals  (ASP).   ASP wants to make  sure that the shareware
  132.             principle works for you. If you are unable to  resolve a shareware
  133.             -related  problem  with  an ASP  member by  contacting  the member
  134.             directly,  ASP may be able to help. The ASP Ombudsman can help you
  135.             resolve a  dispute or  problem with  an ASP  member, but does  not
  136.             provide  technical support for  members' products. Please write to
  137.             the  ASP Ombudsman at P.O.  Box 5786, Bellevue, WA 98006 or send a
  138.             Compuserve message via easyplex to ASP Ombudsman 70007,3536.
  139.  
  140.             While CSD has  no immediate plans to move, businesses do move from
  141.             time  to time.  Since shareware tends  to remain on  some bulletin
  142.             boards without  update  for many  years, if  the shareware  author
  143.             does  move, you may experience a problem in contacting the author.
  144.             You may also contact ASP  to learn of the  current address of  any
  145.             ASP member if you experience this problem.
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.             Page 2                      PowerBatch                      Page 2
  154.  
  155.             Trademarks
  156.             ----------
  157.  
  158.             PowerBatch is a trademark of Computing Systems Design, Inc.
  159.             MS-DOS is a trademark of Microsoft Corporation.
  160.             IBM and PC-DOS are trademarks of IBM Corporation.
  161.             ASP, Association of Shareware Professionals,  and the ASP logo are
  162.             registered    trademarks   of   the   Association   of   Shareware
  163.             Professionals.
  164.  
  165.             Liscense Agreement
  166.             ------------------
  167.  
  168.             By  installing  PowerBatch  on  your  system,  you  indicate  your
  169.             agreement  to the  following terms and  conditions. If you  do not
  170.             agree  to these  conditions, you  should not  install and  use the
  171.             PowerBatch   System.  POWERMAK,  SMLMODEL,  and  the  accompanying
  172.             supporting  programs  and   documentation  will   be  collectively
  173.             referred to as PowerBatch.
  174.  
  175.             Users  of  PowerBatch must  accept  this disclaimer  of  warranty:
  176.             "PowerBatch is supplied as is.  The author disclaims all
  177.             warranties,  expressed or  implied, including, without limitation,
  178.             the warranties of  merchantability and of fitness for any purpose.
  179.             The   author  assumes   no  liability   for  damages,   direct  or
  180.             consequential, which may result from the use of PowerBatch."
  181.  
  182.             PowerBatch  is a "shareware program"  and is provided at no charge
  183.             to the user  for evaluation.   Feel free  to share the  EVALUATION
  184.             COPY with your friends, but please do not give  it away altered or
  185.             as  part of  another  system.   The  essence  of  "user-supported"
  186.             software  is  to  provide personal  computer  users  with  quality
  187.             software  without high  prices, and  yet to  provide incentive for
  188.             programmers  to continue  to develop  new products.   If  you find
  189.             this  program useful  and find that  you are using  PowerBatch and
  190.             continue to  use PowerBatch after a 30 day trial  period, you must
  191.             make  a  registration payment  to Computing  Systems Design,  Inc.
  192.             (CSD, Inc.).   The registration fee  will license one copy for use
  193.             on  any  one computer  at  any one  time.    You  must treat  this
  194.             software just like a book.   An example is  that this software may
  195.             be used  by any number of people and may be  freely moved from one
  196.             computer  location to another, so  long as there is no possibility
  197.             of  it  being  used at  one  location  while it's  being  used  at
  198.             another. Just as  a book cannot  be read by two  different persons
  199.             at the same time.
  200.  
  201.             Commercial  users (every user except personal users) of PowerBatch
  202.             must  register and  pay for their  copies of PowerBatch  within 30
  203.             days  of first  use or their  license is withdrawn.   Site-License
  204.             arrangements  may be made  by contacting Computing Systems Design,
  205.             Inc. (CSD, Inc.).
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.             Page 3                      PowerBatch                      Page 3
  214.  
  215.             Anyone  distributing PowerBatch for  any kind of remuneration must
  216.             first  contact Computing Systems  Design, Inc.  (CSD, Inc.) at the
  217.             address  on the  title page for  authorization. This authorization
  218.             will  be automatically  granted to distributors  recognized by the
  219.             (ASP)  as adhering  to its guidelines  for shareware distributors,
  220.             and such distributors  may begin  offering PowerBatch  immediately
  221.             (However Computing Systems Design, Inc.  (CSD, Inc.) must still be
  222.             advised  so that  the distributor can be  kept up-to-date with the
  223.             latest version of PowerBatch.).
  224.  
  225.             You  are encouraged to pass an EVALUATION COPY of PowerBatch along
  226.             to  your  friends  for  evaluation.    Please  encourage  them  to
  227.             register their  copy if  they  find  that they  can use  it.   All
  228.             registered  users will  receive a  copy of  the latest  version of
  229.             PowerBatch.  Distribution of registered  copies of PowerBatch is a
  230.             violation of copyright laws.
  231.  
  232.             To register your copy of PowerBatch, print the file  REGISTER.FRM,
  233.             complete  this form, and send  along with your registration fee to
  234.             CSD,  Inc.  You will  receive the  latest version  of the  program
  235.             along  with the latest documentation. The fully registered version
  236.             of  the program  removes all references  to evaluation. Registered
  237.             users will receive notice of  all updates made to  the program and
  238.             these  updates will be supplied  to registered users for a nominal
  239.             charge.  Every effort will be made to supply updates to registered
  240.             users at the lowest possible cost.
  241.  
  242.             If  you  need  to  submit an  invoice  to  your  accounts  payable
  243.             department,   print  the   form  INVOICE.FRM   and  fill   in  the
  244.             appropriate blanks.
  245.  
  246.             Registration Fees And What You Get
  247.             The   evaluation  version  of  PowerBatch  contains  100%  of  the
  248.             capabilities  of  the  registered  version.   Those  who  register
  249.             PowerBatch will  receive the latest  release of  the software  and
  250.             documentation  and will  receive update  offers in  the mail  at a
  251.             minimal cost  as they  become available.  CSD maintains copies  of
  252.             innovative batch  files submitted  by users  and will  include the
  253.             best of these batch files along with the registered software.
  254.  
  255.             The  registration fee  for PowerBatch is US  $30. Price is subject
  256.             to change without  notice but will  be guaranteed through December
  257.             1990. If  payment is by check, these  funds must be  drawn on a US
  258.             bank.  Unfortunately the  processing of  non-US checks  can  be as
  259.             much as $20 and we cannot afford this type  of transaction. We are
  260.             continually  looking   for  innovative   ways   to  serve   non-US
  261.             customers.
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.             Page 4                      PowerBatch                      Page 4
  270.  
  271.             Software Support
  272.             ----------------
  273.  
  274.             Support for PowerBatch  may be obtained by contacting CSD,Inc.  on
  275.             Compuserve  using Compuserve Mail (EasyPlex). Address inquiries to
  276.             Compuserve  ID 72701,155. If you  are not a Compuserve member, you
  277.             may obtain support by writing to:
  278.  
  279.                               Computing Systems Design, Inc.
  280.                                    6712 E. 102nd Street
  281.                                   Tulsa, Oklahoma 74133
  282.  
  283.             If  you feel  you have a  question that needs  immediate attention
  284.             and  you are a registered  user, CSD's office hours  are 8AM until
  285.             5PM CST. We will  be happy to discuss any problems or  suggestions
  286.             for PowerBatch but time does  not permit us to help you debug your
  287.             PowerBatch source problems.
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.             Page 5                      PowerBatch                      Page 5
  296.  
  297.                                    Concept Of Operation
  298.  
  299.             PowerBatch  is a  compiler for batch file  "type" commands. At the
  300.             present  time there  are 35  PowerBatch commands  which will  work
  301.             only in  a  PowerBatch source  file (they  will not  execute in  a
  302.             standard  DOS batch  file). Any  valid executable  command (.EXE &
  303.             .COM) as  well as  any of  the  DOS intrinsic  commands are  valid
  304.             within  a PowerBatch  source file  and will  be  "compiled". These
  305.             .EXE,  .COM  and DOS  intrinsic commands  will be  executed via  a
  306.             shell  and  the PowerBatch  .EXE program  will continue  execution
  307.             with  the next  compiled statement following  the shelled command.
  308.             There   are   two   main   modules   supplied   with   PowerBatch;
  309.             1)POWERMAK.EXE  and  2)SMLMODEL.MDL. PowerMak  reads,  parses  the
  310.             source  file,  and compiles  the source  extracting routines  from
  311.             SmlModel.  The result  is a  completely standalone  .EXE file that
  312.             executes  without  SmlModel or  PowerMak.  The increase  in  speed
  313.             comes from  the use  of  the PowerBatch  commands as  the DOS  and
  314.             executable modules will  not be executed any faster. Most  notable
  315.             is  the  increase  in  speed  dealing  with  screen  writes.  Many
  316.             capabilities  are provided in  PowerBatch commands that simply are
  317.             not available with standard DOS commands.
  318.  
  319.                                     Why Use PowerBatch
  320.  
  321.             There  are  four major  reasons  for  using a  compiled PowerBatch
  322.             program:
  323.                  1)  The  resulting  program  will  almost  certainly  execute
  324.                     considerably  faster.   While  it  might  be  possible  to
  325.                     construct  a compiled  PowerBatch  program that  does  not
  326.                     execute faster, it would have to  consist entirely of pre-
  327.                     existing executable modules.
  328.                  2) PowerBatch  commands provide  a  considerable increase  in
  329.                     flexibility and power over conventional batch files.
  330.                  3) PowerBatch  programs  cannot  be  changed  without  making
  331.                     machine   code   modifications.  This   means   additional
  332.                     security for distributed batch files.
  333.                  4)  PowerBatch  programs  can  be  created  quickly  for  the
  334.                     PowerBatch command set is a very high level language.
  335.  
  336.             PowerBatch commands fall into 5 classes of commands;
  337.               1) Commands which  provide systems  information. These  commands
  338.                  provide  the current  color settings,  the current  date, the
  339.                  current  time, check  for  the  existance  of a  valid  drive
  340.                  letter,  and commands  which  check for  the  existance  of a
  341.                  directory or a file.
  342.               2)  Commands  which  control  the  flow of  the  batch  program.
  343.                  Execute  different  portions of  the batch  program based  on
  344.                  existance  or non-existance of directories  or files. Compare
  345.                  the contents  of one  variable with the  contents of  another
  346.                  variable  or a constant and execute different portions of the
  347.                  batch program based on the results of the compare.
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.             Page 6                      PowerBatch                      Page 6
  356.  
  357.               3)  Commands  which  control the  way  text  is printed  on  the
  358.                  screen.  Change any portion of the screen to any valid screen
  359.                  color,  cause a message to  blink on the screen, or highlight
  360.                  a message in reverse video.
  361.               4)  Commands which provide  string manipulation. Change a string
  362.                  to all upper  case characters, or  all lower case characters.
  363.                  Extract  a  portion  of a  string  such  as the  first  three
  364.                  characters or the last  four characters. Build  a new  string
  365.                  from  two  existing  strings  by  concatenation  of  the  two
  366.                  strings.
  367.               5)  Commands which  deal with screen writing  and input from the
  368.                  keyboard.   These  commands   are  the  main   power  in  the
  369.                  PowerBatch system.  Directly  address  any  position  on  the
  370.                  screen and move the cursor to that position to  read or write
  371.                  text. Automatically center  a message  or title on any  line.
  372.                  Draw boxes  around portions of  the screen  to enhance screen
  373.                  appearance. Read  a single key  from the  keyboard, read  the
  374.                  response to a query that only  accepts a yes or  no response,
  375.                  read  a  string  of  characters  from  the  keyboard  with  a
  376.                  specified  maximum length,  and read  keys from  the keyboard
  377.                  automatically changing the characters to upper case.
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.             Page 7                      PowerBatch                      Page 7
  386.  
  387.                                        Installation
  388.  
  389.             Installation is  accomplished by executing  the PBInstal  program.
  390.             It  seemed only  fitting that this  install program be  a compiled
  391.             PowerBatch  program. I  believe this  to be  the epitome  of self-
  392.             installing  software.  The  two  main   modules  POWERMAK.EXE  and
  393.             SMLMODEL.MDL must  be located  in the  DOS  path to  allow you  to
  394.             compile  PowerBatch programs  from any  directory on  your system.
  395.             PowerBatch  may be run  on a system  as small  as a  single floppy
  396.             drive system with 128K. There  will be some limit to the number of
  397.             source statements that  may be compiled on  a system this small as
  398.             memory  is  dynamically  allocated as  compilation  progresses.  A
  399.             source  file of  several hundred statements  can be compiled  on a
  400.             small machine.
  401.  
  402.             PowerBatch may  be installed  from either  drive A, B,  or a  hard
  403.             drive.
  404.  
  405.             If the PowerBatch source is  on a floppy disk, you may execute the
  406.             install procedure by:
  407.  
  408.               1) If your  current drive  is the  A: (or  B:) drive then  enter
  409.                  PBInstal <enter>.
  410.               2)  If you current  drive is other  than A:  (or B:)  then enter
  411.                  A:PBInstal <enter> (or B:PBInstal <enter>).
  412.  
  413.             If you  are installing PowerBatch from  a fixed disk drive such as
  414.             C:, then  make the directory  which contains the PowerBatch source
  415.             the  current  default  directory.  For  example  if  you have  the
  416.             PowerBatch  source in  a directory  named C:\TEMP,  then at  a DOS
  417.             prompt enter
  418.  
  419.             CD \TEMP <enter>
  420.             PBInstal <enter>
  421.  
  422.             You  will  first  be  asked to  enter  the  directory  name  which
  423.             contains the PowerBatch source. Next you will be asked to enter  a
  424.             directory name  on your  DOS  path where  the PowerBatch  compiler
  425.             will be placed.  POWERMAK.EXE and SMLMODEL.MDL  will be  placed in
  426.             this  directory. Before  you begin the  installation process, know
  427.             the name of a directory which is on the DOS  search path where you
  428.             will  place these  two files. The  install program will  not allow
  429.             you to  place the  compiler  in  a directory  that is  not on  the
  430.             search path.
  431.  
  432.             Now  you will be asked  to enter a  directory name where you would
  433.             like  the documentation,  informational, and  example files  to be
  434.             placed. This directory does not  have to be on  your DOS path.  If
  435.             this  directory  does  not  exist,  PowerBatch  will  create  this
  436.             directory   for  you   if  you   desire.  The   documentation  and
  437.             information files will be placed in this directory.
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.             Page 8                      PowerBatch                      Page 8
  446.  
  447.             The  first  time that  you run  the PowerBatch  compiler, it  will
  448.             customize  itself for the computer  on which you are running. This
  449.             process takes about  a minute and  will not run  again. Take  this
  450.             opportunity  to learn about the shareware distribution process and
  451.             how to  register PowerBatch if  after taking it for  a test drive,
  452.             you  feel  you  would  like  to  add  it  to  your  collection  of
  453.             utilities.
  454.  
  455.             We  at CSD  would like  to share  innovative batch  file creations
  456.             with  our customer  base. If  you have  created such  a PowerBatch
  457.             program  and would  like to share it  with other PowerBatch users,
  458.             send it to us and if  we agree with you we  will include it on our
  459.             registration  disk  to  our customers.  You  may  mail us  a  disk
  460.             containing   the  PowerBatch  source   or  you  may  send  it  via
  461.             CompuServe EasyPlex.
  462.  
  463.             Our address is:
  464.               CSD, Inc.
  465.               6712 E. 102nd Street
  466.               Tulsa, Oklahoma 74133
  467.  
  468.             Our CompuServe ID is 72701,155.
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.             Page 9                      PowerBatch                      Page 9
  477.  
  478.                           Constructing A PowerBatch Source File
  479.  
  480.             Use  your favorite  text editor to  create a printable  ascii file
  481.             containing   PowerBatch  source   commands  and   DOS   executable
  482.             commands.  A printable ascii file  is one that may be typed to the
  483.             screen  (ie type  myfile.pwr <enter>)  and the  results printed on
  484.             the  screen contain  only the  file  contents. Most  files created
  485.             with  a word  processor are not  printable ascii files  unless you
  486.             specify an ascii file output option.
  487.  
  488.             Compile  your  source  statements  to  create  a  .EXE  executable
  489.             module. This is done using the POWERMAK compiler. The syntax is:
  490.  
  491.                  POWERMAK MyFile [OutFile] [+M]
  492.  
  493.             PowerMake assumes  the extension of the  input file to be .PWR (ie
  494.             MYFILE.PWR)  and will  create an output  file of MYFILE.EXE  if no
  495.             OutFile  parameter is specified. The  input source file may be any
  496.             DOS name  of your  choice(including the  extension). You may  also
  497.             specify an output file name of your choice but the extension  will
  498.             always  be .EXE.  If you do not  enter the input file  name on the
  499.             command line, the  program will prompt you  for the name. You must
  500.             at this time enter the complete name including the extension.
  501.  
  502.             If you wish  to generate a  list of all  literals, variables,  and
  503.             labels  used in your PowerBatch  program, add +M to the end of the
  504.             command  line.   This  variable  map  will   be  written  to   the
  505.             POWERBAT.ERR file.
  506.  
  507.             If the compiler finds no compilation  errors, the compiled version
  508.             of  your  source file  will be  generated. For  an explanation  of
  509.             compilation   errors,  see   the  section   entitled  "Compilation
  510.             Errors".  Compilation errors  appear  on your  screen as  they are
  511.             encountered and they  are written  to a  file named  POWERBAT.ERR.
  512.             The  entire  source  code  is scanned  each  time  you  compile  a
  513.             PowerBatch  program (ie  the compiler does not  stop when an error
  514.             is found, but attempts to identify all errors on each pass).  This
  515.             means  that  some errors  will be  the result  of previous  errors
  516.             found in the source.
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.             Page 10                     PowerBatch                     Page 10
  525.  
  526.                                    PowerBatch Commands
  527.  
  528.             Commands,  Variable  Names, and  Labels  are not  case  sensitive.
  529.             Everything  on the command source  line is converted to upper case
  530.             except  a literal  which is enclosed within  quotes. Either single
  531.             quotes(')  or double  quotes(") may be  used to denote  a literal.
  532.             Literals   which  are  numeric  such  as  color  values,  variable
  533.             lengths,  etc. should not be enclosed in quotes. The compiler does
  534.             evaluate  each  literal  (both alpha  and  numeric)  in  the  same
  535.             manner. The  evaluation process is  1) remove leading and trailing
  536.             quotes if any,  2) attempt  to convert literal  to numeric, 3)  if
  537.             numeric conversion  is successful,  consider it  a  number, 4)  if
  538.             numeric  conversion is  unsuccessful, consider  it  alpha numeric.
  539.             This  means that internally  an operand of 3 and  "3" will both be
  540.             numeric.
  541.  
  542.             A  semicolon which  is not enclosed within  quotes or a  part of a
  543.             command is used to denote a  comment. Semicolons which are part of
  544.             a command must not be  preceded by a space.  A comment begins with
  545.             a  semicolon which follows a space not within quotes. Comments may
  546.             appear  anywhere  on the  command  line,  but  everything after  a
  547.             semicolon on a  command line  is ignored. A  comment may begin  in
  548.             column 1 by placing the  semicolon in column 1.  The following are
  549.             NOT comments:
  550.  
  551.               path=d:\;c:\util;c:\wp
  552.               path   "d:\;c:\util;c:\wp"
  553.               WriteLine   "Punctuation may be used within quotes;"
  554.  
  555.             These ARE comments:
  556.  
  557.               Variable    ColorSave,3 ;save the original color
  558.               SetVar      Msg, ErrMsg ;set Msg to "Invalid input; re-enter"
  559.  
  560.             The starting location on the command line  of the command and  the
  561.             operands is  not important and tabs and spaces may  be freely used
  562.             for readability.
  563.  
  564.             Variable names and command  labels may be any length in the source
  565.             command   but  are  significant   only  through  the  first  eight
  566.             positions.
  567.  
  568.             Variables, Literals, and Labels
  569.  
  570.             A variable is a location  in memory that you  allocate and give  a
  571.             name and a maximum length.  Anytime you refer to the "name" of the
  572.             variable, you are referencing  the memory locations  set aside for
  573.             this  variable. Variable names give  you an easy way to manipulate
  574.             data  internally within  the computer. The  following are examples
  575.             of variables:
  576.               Variable    CharIn,1
  577.                     This  variable  gives  the name  "CharIn"  to  one  memory
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.             Page 11                     PowerBatch                     Page 11
  586.  
  587.                     position. It  will be used to hold one character responses
  588.                     from the keyboard by the user. 
  589.  
  590.               Variable    PBDir,79
  591.                     This  variable appears  in the PBInstal  program and holds
  592.                     the  name of  the directory where  the PowerBatch compiler
  593.                     will  be placed.  It is composed  of the drive  letter and
  594.                     directory   entered  by  the   user  in  response  to  two
  595.                     questions during the installation process.
  596.  
  597.               Variable    CompName,35,"The ABC Company"
  598.                     This  variable reserves  35 positions in  memory and gives
  599.                     these  locations   the  name   CompName.  The   PowerBatch
  600.                     compiler  also places the  initial value "The ABC Company"
  601.                     in  the first  15 positions of the  variable. The value of
  602.                     this variable  may be changed  by later  processing in the
  603.                     program.
  604.  
  605.               Variable    MsgClear,20,"                    "
  606.                     This  variable contains  20 spaces and  is named MsgClear.
  607.                     It  will be  used to "clear"  or overwrite with  spaces an
  608.                     error message in  your program. Once you have displayed  a
  609.                     message  to the user, it should be cleared as you continue
  610.                     with  the  program.  This  is  done  by  overwriting  with
  611.                     spaces.  Having  a variable  with  the correct  number  of
  612.                     spaces makes this task easier.
  613.  
  614.             There  are two  predefined variables  in each  PowerBatch program;
  615.             ERRORLEVEL  and DOSERROR. The ErrorLevel variable and the DOSError
  616.             variable are updated  each time an  external command  is executed.
  617.             If  you execute a program  which sets an  error code on exit, this
  618.             error  code  will  be in  ERRORLEVEL.  The  use of  ERRORLEVEL  in
  619.             PowerBatch  is equivalent  to the use of  ERRORLEVEL in a standard
  620.             DOS batch  file. If you  execute an  external command(program) and
  621.             that  command does  not terminate normally,  the variable DOSERROR
  622.             will  be set  to  the DOS  error code  assigned  by  the operating
  623.             system.  It  is  good practice  to examine  the  DOSERROR variable
  624.             after executing an external command.
  625.  
  626.             Literals are  very much like variables  which have a  value but no
  627.             name.  Literals are  used in PowerBatch commands  when you wish to
  628.             pass an actual  value to the command  instead of a variable.  Note
  629.             in  the following  examples that literals  containing numbers only
  630.             are  not  enclosed  in quotes  and  literals  containing  any non-
  631.             numeric  characters are  enclosed  in  quotes. If  you  specify  a
  632.             number  as a  literal either convention is  acceptable (3 or "3").
  633.             If  you specify  alphabetic characters,  the quotes  are required.
  634.             For readability, and  ease of entry,  numeric literals  usually do
  635.             not contains quotes. Examine the following examples of literals:
  636.  
  637.               Center      "Installation Program",1
  638.                     This  command   will  center  the  literal   "Installation
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.             Page 12                     PowerBatch                     Page 12
  647.  
  648.                     Program" on  line 1 of  the screen. The text "Installation
  649.                     Program"  must  appear somewhere  in  the program  and  it
  650.                     appears as a literal. It will  occupy memory positions and
  651.                     will have a value but you may not reference this value  by
  652.                     name.  By instructing the  compiler to write this literal,
  653.                     the  compiler automatically  creates the  memory locations
  654.                     and  initial value but gives  it no name.  The 1 is also a
  655.                     literal in this command.
  656.  
  657.               WriteAt     12,3,Msg1
  658.                     There are  two literals  in this  command. The  numbers 12
  659.                     and  3 are both created  as literals. In this command they
  660.                     specify the column and row location where the string  Msg1
  661.                     will  be written.  Again, the compiler  creates the memory
  662.                     locations and values  for these literals, but no names. If
  663.                     you  were  to  write  another  command  such  as  the Beep
  664.                     command  which specifies that the system speaker will beep
  665.                     at  a certain  frequency for  3 times,  the compiler  will
  666.                     find  the  previously defined  literal  "3" and  use  this
  667.                     value instead of creating another literal.
  668.  
  669.               Beep        ErrTone,8,3
  670.                     This  is  the  Beep command  referenced  in  the  previous
  671.                     example. The beep  command will cause the speaker to sound
  672.                     at  a  frequency of  ErrTone for  .8 second  and repeat  3
  673.                     times.  The "3" literal will use the  same memory location
  674.                     reference  as  the WriteAt  command used  in the  previous
  675.                     command (ie another literal will not be created).
  676.  
  677.             Labels  are names of a particular place in your PowerBatch program
  678.             that  you will  go to without executing  the previous command. You
  679.             go  directly to this location in the program from another location
  680.             in  the program based on a decision you have  made in the program.
  681.             Examples will help explain:
  682.  
  683.               ReadYN      "Do you wish to continue [Y/N] ",InChar
  684.               Compare     InChar,"Y",,,GetDrive
  685.               Halt        999
  686.               ;end the program if user enters "N"
  687.               Label       GetDrive
  688.                     This  group of  commands writes the message  on the screen
  689.                     and asks  the user  to input either  Y or  N (the  command
  690.                     will  only accept these  two characters). A comparision is
  691.                     then  made to  a literal "Y" and  the compare command will
  692.                     jump  to the  location in the program  named GetDrive if a
  693.                     "Y"  was entered  or will execute the  next command if "N"
  694.                     was entered.
  695.  
  696.               GoTo        NextCmd
  697.               .
  698.               .
  699.               .
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.             Page 13                     PowerBatch                     Page 13
  708.  
  709.               Label       NextCmd
  710.                     In  this most straightforward  use of  the label, the user
  711.                     simply  uses the GoTo command and jumps unconditionally to
  712.                     another point in the program.
  713.  
  714.             External  commands  are entered  just as  PowerBatch commands  are
  715.             entered.  If you  enter an external command  and this command uses
  716.             command line parameters, these parameters may be  passed as either
  717.             variables  or literals.  Remember that  if  the parameter  is  not
  718.             numeric, it must be enclosed in quotes or it will be  treated as a
  719.             variable. Examples:
  720.  
  721.               Variable    InChar,1
  722.               ReadYN      "Do you wish a directory ",InChar
  723.               Compare     InChar,"Y",NextSec,NextSec
  724.               DIR         "/W"
  725.  
  726.               Variable    PgmName,12
  727.               Write       "Enter the name of the program to compile "
  728.               ReadStr     PgmName
  729.               TPC         PgmName, "/ddebug"
  730.  
  731.             This  third example of external  commands show the  use of the two
  732.             predefined  variables,   ERRORLEVEL   and   DOSERROR.  After   the
  733.             execution  of  "TestPgm",  we  examine  DOSError  to  find  if the
  734.             program  executed OK (Possibly there  was not enough memory or the
  735.             program  could not  be found on  the DOS path).  After determining
  736.             that the  program executed  OK, we  examine the  exit code set  by
  737.             "TestPgm"  to determine  the flow  of the  remainder of  our batch
  738.             file. This exit code will be found in the variable ERRORLEVEL.
  739.  
  740.               Variable    MsgLine,80
  741.               .
  742.               .
  743.               TestPgm     "Parm1 Parm2"
  744.               Compare     DOSError,0,,,RanOK
  745.               WriteLine   "TestPgm did not execute properly...terminating"
  746.               Halt        DOSError
  747.               Label       RanOK
  748.               Compare     ErrorLevel,1,Chk2,,Option1
  749.               Concat      MsgLine,"Unexpected return code of ",ErrorLevel
  750.               Halt
  751.               Label       Option1
  752.  
  753.             Note:  PowerBatch  programs may  be executed  by other  PowerBatch
  754.             programs as  external commands.  An option of the  PowerBatch Halt
  755.             command  is  to  set the  DOS  errorlevel.  You could  then  "pass
  756.             parameters"  from  one  PowerBatch  program  to  another  via  the
  757.             ERRORLEVEL variable.
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.             Page 14                     PowerBatch                     Page 14
  766.  
  767.             Command line  parameters may  be passed  to a compiled  PowerBatch
  768.             program. These command line  parameters must be defined at compile
  769.             time and  have special variable names. Up to 16  parameters may be
  770.             passed  to  a  PowerBatch program  and  their  names are  CLP%1  -
  771.             CLP%16.
  772.             If you  wish  to  pass  parameters on  the  command line  to  your
  773.             PowerBatch program, define the variables  in your source  and when
  774.             you  run  the  compiled program,  any  parameters  entered  on the
  775.             command line will be in the defined variable. Example:
  776.  
  777.               Source for SMARTCPY.PWR
  778.  
  779.               Variable    CLP%1,79    ;source file
  780.               Variable    CLP%2,79    ;target file
  781.               Variable    InChar,1
  782.               ReadYN      "Shall I copy the files for you [Y/N] ",InChar
  783.               Compare     InChar,"Y",NoCopy,NoCopy
  784.               COPY        CLP%1, CLP%2
  785.  
  786.               SMARTCPY  FILE1 FILE2 will execute the DOS copy command and copy
  787.             FILE1 to FILE2 if the user responds Y to the question.
  788.  
  789.             Changes To Your Computer's Environment Area
  790.             Your  computer memory contains a special area of memory called the
  791.             "Environment  Area".  This special  area  of memory  contains  the
  792.             values  assigned to  variables  that  are  available  to  the  DOS
  793.             operating system  or to  any application program  running in  your
  794.             computer.   These  values   remain  unchanged  until   DOS  or  an
  795.             application program changes  them as long  as the  power is on  to
  796.             your  computer. DOS maintains  special values  in this  area which
  797.             the operating  system uses. Your current  path and current  prompt
  798.             configuration  are two of  these values. These values are normally
  799.             set  with  the  DOS PROMPT  or  PATH  command. If  an  application
  800.             program   like  a  compiled  PowerBatch  program  executes  a  DOS
  801.             command,  it is done via a "shell" or another copy of your command
  802.             processor  (normally COMMAND.COM)  which is started  to handle the
  803.             execution  of these  DOS commands.  When a  shell is  started, DOS
  804.             creates a  copy of  the environment  area for this  new shell  and
  805.             makes   the   environment   values   available   to   the   shell.
  806.             Unfortunately, when the shell is terminated (when the DOS  command
  807.             is  complete) this copy of  the environment is erased from memory.
  808.             If you execute a PROMPT, PATH or SET [Variable] command, the  copy
  809.             of  the environment created for the shell to run the PROMPT, PATH,
  810.             or  SET  command  is  updated  and  immediately  erased  when  the
  811.             PowerBatch  program is  finished. PowerBatch provides  you a means
  812.             to update both  the permanent  copy and  the current  copy of  the
  813.             environment area with the commands SETPATH, SETENV, PROMPT.
  814.  
  815.             Unfortunately,  problems dealing with  the environment area do not
  816.             end  here. When  DOS runs  a program  (like a  PowerBatch compiled
  817.             program), a copy of the permanent  environment is made and  is the
  818.             "active"  environment aread  in  use  during  the running  of  the
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.             Page 15                     PowerBatch                     Page 15
  827.  
  828.             program.  If  you  only read  the values  of  existing environment
  829.             variables,  there  is  no  problem. If  you  attempt  to  add  new
  830.             environment values, the amount of free  environment space is  very
  831.             limited.  IT IS NOT THE  AMOUNT OF SPACE  ALLOCATED BY YOU IN YOUR
  832.             CONFIG.SYS  FILE (or the default)  MINUS THE AMOUNT OF USED SPACE!
  833.             The amount  of "free"  space appears  to be  only the amount  left
  834.             after  rounding  up  the  amount of  used  space  to  the  nearest
  835.             paragraph of memory (16 bytes).
  836.             The   problem  of   allocating  environment  free   space  can  be
  837.             circumvented  by  updating the  permanent  environment  area  with
  838.             dummy  values prior to the execution of your PowerBatch file. This
  839.             could  be  done  with a  small  PowerBatch  program such  as  ENV-
  840.             INIT.PWR as follows:
  841.  
  842.               SetEnv   Env1,'dummy value dummy value'
  843.               SetEnv   Env2,'dummy value dummy value'
  844.               .
  845.               .
  846.               .
  847.             When  ENV-INIT terminates, the environment variables Env1 and Env2
  848.             will  have  the  dummy  values and  will  now  be  a  part  of any
  849.             environment  area copy  passed to a running  program. You could of
  850.             course use  the DOS  SET  command  from the  DOS command  line  or
  851.             initialize  the environment  variables with  dummy values  in your
  852.             AUTOEXEC.BAT file.
  853.  
  854.             Command Notation
  855.             In  the  description  of the  commands  which  follow, that  which
  856.             appears  within brackets  [ ] is  optional and all  other operands
  857.             are required.  Any  time a  screen color  may  be  specified in  a
  858.             command such as
  859.  
  860.               CLEARLINE LineNumber,ForegroundColor,BackgroundColor
  861.  
  862.             the  single attribute which is  used in many color conventions may
  863.             be  substituted for  the pair  of color  attributes. For  example,
  864.             foreground color  4 (red), background color 1 (blue), is identical
  865.             to  color attribute 20 and  the CLEARLINE command may be specified
  866.             EITHER as 
  867.  
  868.               CLEARLINE 14,4,1
  869.             or
  870.               CLEARLINE 14,20
  871.  
  872.             to  clear  line  14  on  the  screen  to  red foreground  on  blue
  873.             background.  For  this  reason anytime  that the  operand  pair of
  874.             foreground  color, background color  is required, the single color
  875.             attribute  may be substituted for  the pair. The compiler will not
  876.             detect  missing background  color attributes but  will assume that
  877.             the foreground is the composite value.
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.             Page 16                     PowerBatch                     Page 16
  886.  
  887.             Command Syntax
  888.             The  number which  is immediately  under the  command name  is the
  889.             line  number in  the DEMO1 file (printed  in the examples section)
  890.             which uses this command.
  891.  
  892.             ?COLOR        VarName1, VarName2, VarName3
  893.             (25) Retrieve  the current  color attributes  from the  system and
  894.                     place  the  current  foreground  color  in  VarName1,  the
  895.                     current  background color  in VarName2,  and the composite
  896.                     attribute in VarName3.
  897.  
  898.                  Ex:   Variable ForeColor,3
  899.                        Variable BackColor,3
  900.                        Variable ColorAttr,3
  901.                        ?Color   ForeColor,BackColor,ColorAttr
  902.  
  903.                     Retrieve  the current foreground, background and composite
  904.                        color  values and  place  in  the variables  ForeColor,
  905.                        BackColor, and ColorAttr repectively.
  906.  
  907.             ?CURRDIR      VarName1, VarName2
  908.                  Retrieve the current drive and directory from the system  and
  909.                     place  the  current  drive in  VarName1  and  the  current
  910.                     directory  in VarName2. The  contents of VarName1 prior to
  911.                     execution of this command  control which currently  logged
  912.                     drive  is searched for  the currently logged directory. If
  913.                     ?CurrDir finds a valid drive letter in the first  position
  914.                     of VarName1,  then the  contents of  VarName2 will be  the
  915.                     currently  logged directory  of that  drive. If  the first
  916.                     position  of  VarName1  does not  contain  a  valid  drive
  917.                     letter, then  VarName2 will contain  the currently  logged
  918.                     directory  of the  current drive. In  either case VarName1
  919.                     will  contain  the drive  and  VarName2 will  contain  the
  920.                     directory.
  921.  
  922.                  Ex:   Variable    CurrDrive,2
  923.                        Variable    CurrDir,79
  924.                        SetVar         CurrDrive,"A"
  925.                        ?CurrDir    CurrDrive,CurrDir
  926.                        SetVar         CurrDrive,""
  927.                        ?CurrDir    CurrDrive,CurrDir
  928.  
  929.                  In the first usage of  ?CurrDir, assuming that  the currently
  930.                     logged directory  on the A  drive is  the root  directory,
  931.                     CurrDrive  will contain  "A" and CurrDir  will contain "\"
  932.                     after  the  execution of  ?CurrDir. In  the second  usage,
  933.                     assuming that  the currently  logged drive  is D:  and the
  934.                     currently  logged   directory   on   the   D:   drive   is
  935.                     "\UTIL\EXEC", CurrDrive  will contain "D" and CurrDir will
  936.                     contain "\UTIL\EXEC" after the execution of ?CurrDir.
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.             Page 17                     PowerBatch                     Page 17
  945.  
  946.             ?DATE         VarName1, VarName2, VarName3, VarName4
  947.             (26) Retrieve  the current date from  the system and place the day
  948.                     of  the week  in VarName1, the month  in VarName2, the day
  949.                     in VarName3, and the year in VarName4. VarName1 should  be
  950.                     defined  as 9  long, VarName2 and VarName3  as 2 long, and
  951.                     VarName4 as 4 long.
  952.  
  953.                  Ex:   Variable DOW,9
  954.                        Variable Mo,2
  955.                        Variable Da,2
  956.                        Variable Yr,4
  957.                        ?Date    DOW,Mo,Da,Yr
  958.  
  959.                     Retrieve  the current  date and place  the component parts
  960.                        in  their respective  variables. Place  the day  of the
  961.                        week  in DOW (ie Saturday),  the month number in Mo (ie
  962.                        06),  the day of the  month in Da (ie 29), and the year
  963.                        in Yr (ie 1990).
  964.  
  965.             ?DIREXIST     VarName1, Label1 [,Label2]
  966.             (159)         Literal1,Label1 [,Label2]
  967.                  Check the  system for  the existance of  the directory  whose
  968.                     name  appears in VarName1 or in Literal1. If the directory
  969.                     exists jump to  the command immediately following  Label1,
  970.                     if  the  directory does  not  exist,  jump to  the command
  971.                     immediately following Label2.
  972.  
  973.                  Ex:   ?DirExist   InpStr,DirOk,BadDir
  974.                        ?DirExist   "C:\",DirOK,BadDir
  975.                        ?DirExist   InpStr,,BadDir (next command if exists)
  976.                        ?DirExist   InpStr,DirOk   (next command if not exist)
  977.                  In  the first example if  the contents of the variable InpStr
  978.                     exists then goto  label DirOK, if it  does not exist go to
  979.                     the  label BadDir. In the  second example we check for the
  980.                     existance  of  a literal  with a  value of  "C:\". In  the
  981.                     third example,  if the contents of  InpStr exist we  "fall
  982.                     through"  to the  next instruction, if  the directory does
  983.                     not  exist  we jump  to the  label BadDir.  In the  fourth
  984.                     example, if the directory name in  InpStr exists, we  jump
  985.                     to the label DirOK, if it  does not exist we  fall through
  986.                     to the next command.
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.             Page 18                     PowerBatch                     Page 18
  995.  
  996.             ?DISKSPACE    VarName1, VarName2, VarName3
  997.             (184)         Literal1, VarName1, VarName2
  998.                  Query the  disk Drive  specified by  the  first character  of
  999.                     Varname1 and  place the  total disk capacity  in bytes  in
  1000.                     VarName2  and  the unused  bytes  in VarName3.  Since  the
  1001.                     command looks at  only the first character of VarName1 (or
  1002.                     Literal1),   VarName1  may   contains  strings   such   as
  1003.                     "C:\UTIL".
  1004.                  Ex:   Variable    DirName,79
  1005.                        ReadStr     DirName  (user enters "c:\util")
  1006.                        Upper       DirName  (changes to "C:\UTIL")
  1007.                        ?DiskSpace  DirName,TotSpace,FreSpace
  1008.  
  1009.                        ?DiskSpace  "A",TotSpace,FreSpace
  1010.  
  1011.             ?DRIVEEXIST   VarName1, Label1 [,Label2]
  1012.             (145)         Literal1, Label1 [,Label2]
  1013.                  Check  the system  for VarName1 as  a valid drive  letter. If
  1014.                     the  drive  is  valid, jump  to  the  command  immediately
  1015.                     following  Label1, if  the drive is not  valid jump to the
  1016.                     command immediately following Label2.
  1017.  
  1018.                  Ex:   ?DriveExist DrvNum,GoodDrv,BadDrv
  1019.                        ?DriveExist "A",GoodDrv,BadDrv
  1020.                        ?DriveExist DrvNum,,BadDrv
  1021.                        ?DriveExist DrvNum,GoodDrv
  1022.  
  1023.             ?ENVSTR       VarName1, VarName2
  1024.                           Literal1, VarName2
  1025.                  Retrieve  the contents  of any environment  variable from the
  1026.                     system  environment  area. The  name  of  the  environment
  1027.                     variable  is placed  in VarName1  or entered as  a literal
  1028.                     and  the  contents of  the  environment variable  will  be
  1029.                     placed  in VarName2. Ensure that VarName2 has been defined
  1030.                     sufficiently  long enough  to contain the  contents of the
  1031.                     environment  variable. If VarName2 is not long enough, the
  1032.                     environment variable will be truncated.
  1033.  
  1034.                  Ex:   Variable    EnvValue,255
  1035.                        Variable    EnvName,4,"path"
  1036.                        ?EnvStr     "prompt", EnvValue
  1037.                        ?EnvStr     EnvName, EnvValue
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.             Page 19                     PowerBatch                     Page 19
  1046.  
  1047.             ?FILEEXIST    VarName1, Label1 [,Label2]
  1048.             (172)         Literal, Label1 [,Label2]
  1049.                  Check  the system  for the specified  file name. If  the file
  1050.                     exists, jump to the  command immediately following Label1,
  1051.                     if   the  file  does   not  exist,  jump  to  the  command
  1052.                     immediately following Label2.
  1053.  
  1054.                  Ex:   ?FileExist  FileName, Label1, Label2
  1055.                        ?FileExist  "C:\AUTOEXEC.BAT",StartOK,NoStart
  1056.                        ?FileExist  FileName,,Label2
  1057.                        ?FileExist  FileName,Label1
  1058.  
  1059.             ?INPATH       VarName1, Label1 [,Label2]
  1060.                           Literal1, Label2 [,Label2]
  1061.                  Compare the contents  of VarName1 to  the system search path.
  1062.                     If  VarName1  is contained  within  the  path jump  to the
  1063.                     command  immediately following  Label1, if  the file  does
  1064.                     not  exist  jump  to  the  command  immediately  following
  1065.                     Label2. Use  this command  to determine if a  directory is
  1066.                     specified in the DOS search path.
  1067.  
  1068.                  Ex:   DOS search path contains "C:\UTIL;C:\WORDPROC;D:\"
  1069.                        Variable    InString,79
  1070.                        Write       "Enter your directory name "
  1071.                        ReadStr     InString (user enters "c:\wordproc")
  1072.                        Upper       InString (change to "C:\WORDPROC")
  1073.                        ?InPath     InString,PathOK,BadPath
  1074.  
  1075.                        ?InPath     "C:\UTIL",,BadPath   (compare literal)
  1076.  
  1077.             ?TIME         VarName1
  1078.             (27) Retrieve  the  current time  from  the  system and  place  in
  1079.                     VarName1. The format  of the time is hh:mm:ss xm. VarName1
  1080.                     should be defined as 11 long.
  1081.                  Ex:   Variable CurrTime,11
  1082.                        ?Time    CurrTime (now contains 11:24:14 am)
  1083.  
  1084.             ADD        VarName1,VarName2
  1085.                        VarName1,Literal2
  1086.  
  1087.                  Add  the contents  of VarName2 (or Literal2)  to VarName1 and
  1088.                     place the result in VarName1.
  1089.  
  1090.             BEEP          VarName1, VarName2, VarName3
  1091.             (149)         Literal1, Literal2, Literal3
  1092.                  Sound the  system speaker with  a tone of VarName1 frequency,
  1093.                     for  a length  of VarName2 tenths of  a second, and repeat
  1094.                     VarName3 times.
  1095.                  Ex:   Beep  800,5,3
  1096.                        Beep  ErrFreq,BeepLen,ErrTimes
  1097.                     The first example  sound the system speaker at a frequency
  1098.                        of 800 hz for half a second (.5)  and repeats twice for
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.             Page 20                     PowerBatch                     Page 20
  1107.  
  1108.                        a  total of 3 times.  The second example will sound the
  1109.                        system speaker at a  frequency equal to the contents of
  1110.                        the  variable ErrFreq for BeepLen tenths of a second(s)
  1111.                        for a total of ErrTimes.
  1112.  
  1113.             BLINK
  1114.             (82)
  1115.                  Cause  all text that is written to the  screen to blink using
  1116.                     the   current  color   attributes  last   defined  in  the
  1117.                     processing  of the batch program. This command in "undone"
  1118.                     by using NORMAL.
  1119.  
  1120.                  Ex:   Variable MsgClear,25."                         "
  1121.                        Blink
  1122.                        WriteAt  15,4,"Not a valid entry"
  1123.                        Normal
  1124.                        Wait     35
  1125.                        WriteAt  15,4,MsgClear
  1126.                     Write the message "Not a valid entry" at  column 15 on row
  1127.                        4  using the  current color definition.  Reset the text
  1128.                        color  to  the  value  it contained  before  specifying
  1129.                        blinking text. Wait 3.5 seconds and clear the message.
  1130.  
  1131.             BOX1          VarNm1, VarNm2, VarNm3, VarNm4, VarNm5 [,VarNm6]
  1132.             (36)          Lit1, Lit2, Lit3, Lit4, Lit5 [,Lit6]
  1133.                  Draw  a  box  (frame) on  the  screen  whose upper  left  co-
  1134.                     ordinates  (X,Y) are VarNm1, VarNm2, and whose lower right
  1135.                     co_ordinates  (X,Y) are VarNm3, VarNm4. Draw the box using
  1136.                     a  line  in foreground  color VarNm5  on background  color
  1137.                     VarNm6.
  1138.  
  1139.                  Ex:   Variable ULX,2,5     ;upper left col value
  1140.                        Variable ULY,2,3     ;upper left row value
  1141.                        Variable LRX,2,75    ;lower right col value
  1142.                        Variable LRY,2,20    ;lower right row value
  1143.                        Variable BoxFore,2,4 ;foreground color red
  1144.                        Variable BoxBack,2,0 ;background color black
  1145.                        Box1  ULX, ULY, LRX, LRY, BoxFore, BoxBack
  1146.                        Box1  5,3,75,20,7,0
  1147.                        Box1  5,3,75,20,112
  1148.  
  1149.                     The  first  example  draws  a  box  whose upper  left  co-
  1150.                        ordinates  are the  contents of  the variables  ULX and
  1151.                        ULY  and whose lower left co-ordinates are the contents
  1152.                        of  the variables  LRX and LRY. The  box border will be
  1153.                        the  contents  of  BoxFore (red)  on  a  background  of
  1154.                        BoxBack  (black).  The  interior of  the  box  will  be
  1155.                        unchanged  (ie  it is  not  cleared  nor  is the  color
  1156.                        changed).  The second  example draws a  box whose upper
  1157.                        left  co-ordinates are  5,3 and  whose lower  right co-
  1158.                        ordinates are 75,20.  The box border  is drawn in white
  1159.                        on  black. The third example  draws a box with the same
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.             Page 21                     PowerBatch                     Page 21
  1168.  
  1169.                        co-ordinates and uses the composite color attribute  of
  1170.                        112 (white on black). See ClearBox command.
  1171.  
  1172.             BREAKON
  1173.                  Provides  a capability  to exit from a  PowerBatch program by
  1174.                     pressing  the  combination  of  keys  (Ctrl  -  Break)  or
  1175.                     (Ctrl - C). The default value  set at the beginning of any
  1176.                     PowerBatch  program  is  BreakON.  To  keep  a  user  from
  1177.                     exiting   a  running   PowerBatch  program,   execute  the
  1178.                     BreakOFF command.  If sections  of the  program are to  be
  1179.                     protected and  other sections  not, surround  the sections
  1180.                     with pairs of BreakON...BreakOFF commands.
  1181.  
  1182.             BREAKOFF
  1183.                  Disables   the  ability  to  stop  a  PowerBatch  program  by
  1184.                     pressing  the  (Ctrl   -  Break)   or  (Ctrl   -  C)   key
  1185.                     combinations.  The default  value set at  the beginning of
  1186.                     any PowerBatch program is BreakON.
  1187.  
  1188.             CENTER        VarName1, VarName2
  1189.             (42)          Literal1, Literal2
  1190.                  Center the text in VarName1 on line VarName2.
  1191.  
  1192.                  Ex:   Variable InpStr,25,"PowerBatch"
  1193.                        Center   "PowerBatch",2
  1194.                        Center   InpStr,2
  1195.  
  1196.                     Both  versions  of  this  example  will  center  the  name
  1197.                        "PowerBatch" on line 2 of the screen.
  1198.  
  1199.             CLEAR         VarName1 [,VarName2]
  1200.             (28)          Literal1 [,Literal2]
  1201.                  Clear  the  entire screen  to foreground  color VarName1  and
  1202.                     background color VarName2.
  1203.  
  1204.                  Ex:   Variable ColorAttr,3,112   ;define white on black
  1205.                        Clear    4,1
  1206.                        Clear    112
  1207.                        Clear    ColorAttr
  1208.                     The  first example  clears the screen to  red on blue. The
  1209.                        second  and third examples clear the screen to white on
  1210.                        black.
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.             Page 22                     PowerBatch                     Page 22
  1219.  
  1220.             CLEARBOX      VarNm1, VarNm2, VarNm3, VarNm4, VarNm5 [,VarNm6]
  1221.             (37)          Lit1, Lit2, Lit3, Lit4, Lit5 [,Lit6]
  1222.                  Clear the interior of the box  whose upper left  co-ordinates
  1223.                     (X,Y)  are  VarNm1,  VarNm2  and  whose  lower  right  co-
  1224.                     ordinates  (X,Y) are VarNm3, VarNm4. Clear the interior of
  1225.                     the  box to  foreground color VarNm5  and background color
  1226.                     VarNm6. This command clears the  "inside" of the  box, not
  1227.                     the lines which describe the box.
  1228.                  Ex:   Variable ULX,2,5     ;upper left col value
  1229.                        Variable ULY,2,3     ;upper left row value
  1230.                        Variable LRX,2,75    ;lower right col value
  1231.                        Variable LRY,2,20    ;lower right row value
  1232.                        Variable BoxFore,2,4 ;foreground color red
  1233.                        Variable BoxBack,2,0 ;background color black
  1234.                        Box1     ULX, ULY, LRX, LRY, BoxFore, BoxBack
  1235.                        ClearBox 5,3,75,20,112
  1236.  
  1237.                     In  this example we define  the upper right and lower left
  1238.                        co-ordinates of  the box as  well as the colors BoxFore
  1239.                        and  BoxBack. We  draw the  box with  a red  line on  a
  1240.                        black  background.  The  ClearBox  command  clears  the
  1241.                        interior of the box to white on black.
  1242.  
  1243.             CLEARLINE     VarName1, VarName2 [,VarName3]
  1244.                           Literal1, literal2 [,Literal3]
  1245.                  Clear  the line number specified by VarName1  to a foreground
  1246.                     color of VarName2 and a background color of VarName3.
  1247.  
  1248.                  Ex:   Variable    Red,1,4
  1249.                        Variable    Blue,1,1
  1250.                        Variable    RedOnBlue,2,20
  1251.                        Variable    CurrLine,2,12
  1252.                        ClearLine   12,Red,Blue
  1253.                        ClearLine   CurrLine,RedOnBlue
  1254.  
  1255.                     Both examples  of the ClearLine command  clear line 12  on
  1256.                        the  screen to red foreground color and blue background
  1257.                        color.
  1258.  
  1259.             COLOR         VarName1 [,VarName2]
  1260.             (38)          Literal1 [,Literal2]
  1261.                  Set  the  default  color to  foreground  color  VarName1  and
  1262.                     background color  VarName2 or optionally  set the  default
  1263.                     color attribute to VarName1.
  1264.                  Ex:   Variable RedOnBlue,2,20
  1265.                        Color    4,1
  1266.                        Color    MenuClr
  1267.  
  1268.                     Both  examples set  the default color  to red on  blue for
  1269.                        any  text written to  the screen without specific color
  1270.                        instructions.
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.             Page 23                     PowerBatch                     Page 23
  1279.  
  1280.             COMPARE    VarName1, VarName2, Label1 [,Label2] [,Label3]
  1281.             (30)       Literal1, Literal2, Label1 [,Label2] [,Label3]
  1282.                  Compare   the  contents  of   VarName1  to  the  contents  of
  1283.                     VarName2.  If VarName1  greater than VarName2  jump to the
  1284.                     statement   following  Label1.   If  VarName1   less  than
  1285.                     VarName2  jump  to  the  statement  following  Label2.  If
  1286.                     VarName1 equal  VarName2 jump  to the statement  following
  1287.                     Label3.   If  the  contents  of  the  first  two  operands
  1288.                     (VarName1,  VarName2, Literal1,  or Literal2)  are numeric
  1289.                     then  a   numeric  compare  is   performed  otherwise   an
  1290.                     alphabetic   compare  is   made.   (If   19  is   compared
  1291.                     alphabetically to 2, then 2  is greater than 19;  if it is
  1292.                     compared numerically, 19 is greater than 2.)
  1293.  
  1294.                  Ex:   Variable InChar,1
  1295.                        Variable Yes,1,"Y"
  1296.                        Variable No,1,"N"
  1297.                        GoToXY   4,23
  1298.                        ReadYN   "Incorrect entry...Continue [Y/N] "
  1299.                        Compare  InChar,"Y",NoIn,NoIn,YesIn
  1300.  
  1301.                        Compare  InChar,Yes,,,YesIn   (Not Y falls thru)
  1302.  
  1303.                        Compare  InChar,"Y",NoIn,NoIn (Y falls thru)
  1304.  
  1305.                     In  the  first example  of the  Compare command,  variable
  1306.                        InChar  is  compared  to  literal  "Y".  If  InChar  is
  1307.                        greater than  "Y"  then the  program will  jump to  the
  1308.                        label NoIn;  if InChar  is less  than "Y",  the program
  1309.                        also  jumps to  the label NoIn;  if InChar is  equal to
  1310.                        "Y",  the program will continue processing at the label
  1311.                        named  YesIn.  In  the   second  compare  command,  the
  1312.                        variable  InChar is compared  to the variable Yes which
  1313.                        has an  assigned value of  "Y". If  the variable InChar
  1314.                        contains anything  but "Y", the  program continues with
  1315.                        the  next instruction after  the compare command (it is
  1316.                        said  to  fall through);  if InChar  contains "Y",  the
  1317.                        program will  jump to  the  label YesIn.  In the  third
  1318.                        compare command,  variable InChar  is  compared to  the
  1319.                        literal  "Y".  If  the  variable  InChar  contains  "N"
  1320.                        (ReadYN  prevents  any entry  but Y  or N)  the program
  1321.                        jumps  to the  label NoIn  otherwise it  continues with
  1322.                        the instruction after the compare command.
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.             Page 24                     PowerBatch                     Page 24
  1331.  
  1332.             CONCAT     VarName1, VarName2 [,VarName3]
  1333.             (116)      VarName1, Literal1 [,Literal2]
  1334.                  Concatenate  the  string  in  VarName2  with  the  string  in
  1335.                     VarName3 and place the result in VarName1. If VarName3  is
  1336.                     not  present then concatenate  the string in VarName1 with
  1337.                     the string in VarName2 and place the result in VarName1.
  1338.                  Ex:   Variable    OutMsg,78
  1339.                        Variable    ErrMsg," is not a valid Drive letter."
  1340.                        Variable    DriveLtr,1
  1341.                        WriteAt     6,17,"Enter your source drive letter "
  1342.                        ReadUpKey   DriveLtr
  1343.                        ?DriveExist DriveLtr,DriveOK
  1344.                        Concat      OutMsg, "[19] ", DriveLtr
  1345.                        Concat      OutMsg, " is not a valid Drive letter."
  1346.                        WriteAt     5,23,OutMsg
  1347.  
  1348.                     In  this example we  ask the  user to input  a valid drive
  1349.                        letter  and  verify  this  drive  with  the ?DriveExist
  1350.                        command.  If  the drive  is  not valid  we  concatenate
  1351.                        "[19]"  (the  error  number)  plus   the  drive  letter
  1352.                        entered by the user into the  variable OutMsg. We  then
  1353.                        concatenate the error  message (" is not a valid  Drive
  1354.                        letter.")  onto  the  contents  of  OutMsg. The  result
  1355.                        would  be something  like "[19] L is  not a valid Drive
  1356.                        letter."
  1357.  
  1358.             GOTO       Label1
  1359.             (152)
  1360.                  Jump to the statement identified as command label Label1.
  1361.                  Ex:   GoTo  Error
  1362.                        GoTo  EndOfPgm
  1363.  
  1364.             GOTOXY     VarName1, VarName2
  1365.             (57)       Literal1, Literal2
  1366.                  Move  the cursor to the  column (X) specified in VarName1 and
  1367.                     row (Y) specified in VarName2.
  1368.                  Ex:   Variable CurrX,2
  1369.                        Variable CurrY,2
  1370.                        GoToXY   CurrX, CurrY
  1371.                        GoToXY   12,6
  1372.  
  1373.                     In  the first example the  cursor is moved to the location
  1374.                        specified  by the contents of variable CurrX and CurrY.
  1375.                        In  the second  example,  the cursor  is  moved  to the
  1376.                        location specified by two literals "12" and "6".
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.             Page 25                     PowerBatch                     Page 25
  1385.  
  1386.             HALT       VarName1
  1387.                        Literal1
  1388.                  Halt the  batch file  processing and  set  DOS errorlevel  to
  1389.                     VarName1.
  1390.                  Ex:   Variable Error14,2,14   ;define Error14 as "14"
  1391.                        Halt     99
  1392.                        Halt     Error14
  1393.  
  1394.                     In the  first usage  of the Halt  command, the  PowerBatch
  1395.                        program  is halted and the DOS errorlevel is set to 99.
  1396.                        In  the second usage the  program is halted and the DOS
  1397.                        errorlevel  is set to  the contents of variable Error14
  1398.                        ("14").
  1399.  
  1400.             LABEL      LabelName
  1401.             (34) Define  a location  in the list of  commands that will enable
  1402.                     execution  to  begin  immediately following  this  command
  1403.                     without    necessarily   having   executed   the   command
  1404.                     immediately  prior to the  Label. Jump immediately to this
  1405.                     location  in  the command  stream. See  the discussion  on
  1406.                     labels at the beginning of this section.
  1407.  
  1408.                  Ex:   Label    MatchErr
  1409.                        Label    EndOfPgm
  1410.  
  1411.             LENGTH     VarName1, VarName2
  1412.             (129)      VarName1, Literal1
  1413.                  Calculate the  length of the  string in variable VarName2 and
  1414.                     place the result in VarName1.
  1415.                  Ex:   Variable InString
  1416.                        Variable StrLen
  1417.                        WriteAt  12,14,"Enter your current directory "
  1418.                        ReadStr  InString (user enters c:\util)
  1419.                        Length   StrLen, InString  (StrLen will contain 7)
  1420.  
  1421.             LOWER      VarName1
  1422.             (104)
  1423.                  Change the alphabetic characters in VarName1 to lower case.
  1424.                  Ex:   Variable InString,25
  1425.                        ReadStr  InString (user enters C:\UTIL)
  1426.                        Lower    InString (now contains c:\util)
  1427.  
  1428.             MIDSTRING  VarName1, VarName2, VarName3, VarName4
  1429.             (114)      VarName1, Literal1, Literal2, Literal3
  1430.                  Extract  a substring of VarName2 beginning at offset VarName3
  1431.                     into VarName2  for  a length  of VarName4  and place  this
  1432.                     substring in VarName1.
  1433.  
  1434.                  Ex:   Variable Path,79
  1435.                        WriteAt     1,2,"Enter Drive and Directory name "
  1436.                        ReadStr     Path  (user enters C:\UTIL)
  1437.                        MidString   Drive,Path,1,2 (extract C: from C:\UTIL)
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.             Page 26                     PowerBatch                     Page 26
  1446.  
  1447.  
  1448.             NORMAL
  1449.             (84) Change  the current color attribute(s) back to the definition
  1450.                     prior to the execution of a BLINK or REVERSE command.
  1451.  
  1452.                  Ex:   Color    20    ;set default color to red on blue
  1453.                        Blink          ;changes to blinking red on blue (148)
  1454.                        WriteAt  2,24,"Incorrect...re-enter!"
  1455.                        Normal         ;resets color to 20
  1456.                        Beep     800,8
  1457.                        Wait     35    ;pause 3.5 seconds
  1458.                        WriteAt  2,24,"                    "   ;clear     error
  1459.             msg
  1460.  
  1461.                     This  is an example of  a typical error routine. The color
  1462.                        attribute  is  changed   to  blinking  with  the  Blink
  1463.                        command.  The error  message is  written and  the color
  1464.                        attribute  is changed  back to its  original value with
  1465.                        the  Normal command. The  speaker is "beeped" and after
  1466.                        a wait  of 3.5  seconds, the  error message  is removed
  1467.                        from the screen.
  1468.  
  1469.             PROMPT     VarName1
  1470.                        Literal1
  1471.                  Change  the  current  value  of   the  prompt  to  the  value
  1472.                     specified in VarName1 or in Literal1.
  1473.  
  1474.                  Ex: Prompt     "$p$g"
  1475.              
  1476.             READKEY    VarName1,VarName2
  1477.             (59) Read a single key  from the keyboard and place the result  in
  1478.                     VarName1.  If VarName  2 contains a "1"  after reading the
  1479.                     key from  the  keyboard,  then a  "special key"  has  been
  1480.                     returned  in VarName1. Special keys are are function keys,
  1481.                     Page Up/Down,  cursor movement keys,  etc. If  you are  in
  1482.                     doubt  about  a particular  key, run  the program  "KEYID"
  1483.                     (furnished on  the install disk).  Each key you press will
  1484.                     be  identified as  either a regular  key or a  special key
  1485.                     and  the value that will be returned in VarName1 when this
  1486.                     key is pressed (remember that VarName2 will contain a  "1"
  1487.                     for special keys).
  1488.  
  1489.                  Ex:   Variable CharIn,1
  1490.                        GoToXY   1,14
  1491.                        Write    "Enter the drive letter for output ",4,1
  1492.                        ReadKey  CharIn
  1493.  
  1494.             READSTR    VarName1
  1495.             (109)
  1496.                  Read  a string of characters from the keyboard until the user
  1497.                     presses  the enter  key. Any  number of  characters may be
  1498.                     read up  to the maximum  length specified  for VarName1 in
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.             Page 27                     PowerBatch                     Page 27
  1507.  
  1508.                     the Variable statement.
  1509.  
  1510.                  Ex:   Variable    InString,12
  1511.                        ReadStr     InString    (12 chars max will be read)
  1512.  
  1513.             READUPKEY  VarName1
  1514.             (144)
  1515.                  Read a single character from the keyboard,  changing the case
  1516.                     of any alphabetic  character to upper case and place  this
  1517.                     upper case character in VarName1.
  1518.  
  1519.                  Ex:   ReadUpKey   CharIn
  1520.  
  1521.             READYN     VarName1, VarName2
  1522.             (29)       Literal1, VarName2
  1523.                  Write the message  found in  VarName1 at  the current  cursor
  1524.                     location and wait for  a single key to be entered from the
  1525.                     keyboard. Force the user to enter  either a "Y" or "N" and
  1526.                     place the upper case "Y" or "N" in VarName2.
  1527.  
  1528.                  Ex:   Variable    Msg4,35,"Invalid filename...Continue  [Y/N]
  1529.             "
  1530.                        ReadYN      "Invalid     filename...Continue      [Y/N]
  1531.             ",CharIn
  1532.  
  1533.                        ReadYN      Msg4,CharIn
  1534.  
  1535.                  In both  usages of  the ReadYN command, the  message "Invalid
  1536.                     filename...Continue  [Y/N] "  will  be displayed  and  the
  1537.                     program  will wait  for a response  from the user.  If the
  1538.                     user enters  any characters other than  "Y", "y", "N",  or
  1539.                     "n"  the  system  speaker  will  sound  and  the  user  is
  1540.                     prompted  again  for  input. At  the  completion  of  this
  1541.                     command,  the variable  CharIn will contain  either "Y" or
  1542.                     "N" (always upper case).
  1543.  
  1544.             REVERSE
  1545.                  Change  the  text  attributes to  "reverse  video".  This  is
  1546.                     accomplished by  swapping  the  foreground and  background
  1547.                     attributes. This command is "undone" by using NORMAL.
  1548.  
  1549.                  Ex:   Color    20    ;red on black
  1550.                        Reverse        ;color is changed to black on red
  1551.                        WriteAt  1,15,"Press Escape To Continue"
  1552.                        Normal         ;color is now red on black
  1553.  
  1554.             SETENV     VarName1, VarName2
  1555.                        Literal1, Literal2
  1556.                  Set  the  value  of the  environment  variable  specified  in
  1557.                     VarName1  or Literal1  to the value  specified in VarName2
  1558.                     or Literal2.
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.             Page 28                     PowerBatch                     Page 28
  1567.  
  1568.                  Ex: Variable   VarName,7,"MONITOR"
  1569.                     Variable VarValue,5,"color"
  1570.                     SetEnv   VarName, VarValue
  1571.                     SetEnv   "Monitor","color"
  1572.  
  1573.             SETPATH    VarName1
  1574.                        Literal1
  1575.                  Set  the current  path to the value  specified in VarName1 or
  1576.                     the value specified in Literal1.
  1577.  
  1578.                  Ex:   Variable
  1579.             NewPath,40,"d:\;c:\util\exec;c:\wp\letters;c:\dos"
  1580.                     SetPath  NewPath
  1581.                     SetPath  "d:\;c:\;"
  1582.  
  1583.             SETVAR     VarName1, VarName2
  1584.             (31)       VarName1, Literal1
  1585.                  Set the value of VarName1 to the contents of VarName2.
  1586.  
  1587.                  Ex:   Variable ErrCode,3
  1588.                        Variable FileName,79
  1589.                        SetVar   ErrCode,99
  1590.                        SetVar   FileName,"C:\CONFIG.SYS"
  1591.  
  1592.                     In the first  usage of  the SetVar  command, the  variable
  1593.                        ErrCode  is set  to "99" and the  second usage sets the
  1594.                        variable FileName to "C:\CONFIG.SYS"
  1595.  
  1596.             SUBTRACT   VarName1,VarName2
  1597.                        VarName1,Literal2
  1598.  
  1599.                  Subtract  the  contents of  VarName2 (or  Literal2) from  the
  1600.                     contents of VarName1 and place the result in Varname 1.
  1601.  
  1602.             UPPER      VarName1
  1603.             (101)
  1604.                  Change the alphabetic characters in VarName1 to upper case.
  1605.  
  1606.                  Ex:   Variable InString,25
  1607.                        WriteAt  14,25,"Enter your directory name "
  1608.                        ReadStr  InString    (user enters c:\util)
  1609.                        Upper    InString    (changed to C:\UTIL)
  1610.                        ?InPath  InString,GoodDir  (path is always upper case)
  1611.  
  1612.                     In this example, the user  is prompted for a  path name to
  1613.                        be  entered. The  path name  is to  be compared  to the
  1614.                        system  path for  validity. Since  the contents  of the
  1615.                        system  path are always  in upper  case, we  change the
  1616.                        InString variable to upper case prior to comparision.
  1617.  
  1618.             VARIABLE   VariableName, MaxLength [,InitialValue]
  1619.             (1)  Define  a variable  to PowerBatch.  All  variables used  in a
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.             Page 29                     PowerBatch                     Page 29
  1628.  
  1629.                     PowerBatch  program must have been defined with a VARIABLE
  1630.                     command. VariableName is the  name which you  give to this
  1631.                     variable  and the means by which you refer to the variable
  1632.                     in other PowerBatch statements.  This variable may contain
  1633.                     any  number of  characters up to  MaxLength and is  set to
  1634.                     the  initial value of  InitialValue. See the discussion on
  1635.                     variables at the beginning of this section.
  1636.                  Command  line  parameters passed  to  a  compiled  PowerBatch
  1637.                     program must  be defined  as variables. Up  to 16  command
  1638.                     line  variables  may be  passed to  a compiled  PowerBatch
  1639.                     program  and they  are defined  as CLP%1..CLP%16.  See the
  1640.                     example MOVE1 or MOVE2.
  1641.  
  1642.                  Ex:   Variable    DayOfWeek,9
  1643.                        Variable    ErrMsg1,25,"Invalid directory name."
  1644.                        Variable    InString,80,""
  1645.                        Variable    PauseTime,2,50
  1646.                        Variable    CLP%1,12       (command line parameter %1)
  1647.  
  1648.             WAIT       VarName1
  1649.             (119)      Literal1
  1650.                  Cause  the execution  of a  PowerBatch program  to pause  for
  1651.                     VarName1 tenths of a second(s).
  1652.  
  1653.                  Ex:   Wait        5           (pause half a second)
  1654.                        Wait        PauseTime   (pause 5 seconds)
  1655.  
  1656.             WRITE      VarName1, VarName2 [,VarName3]
  1657.             (58)       Literal1, Literal2 [,Literal3]
  1658.                  Write the string contained in VarName1  at the current cursor
  1659.                     location using  color attributes  foreground VarName2  and
  1660.                     background  VarName3.  In  the  absence  of  VarName2  and
  1661.                     VarName3  use the current  color attributes. The string is
  1662.                     not  followed by a carriage return, line feed pair (ie the
  1663.                     cursor  is not  moved to  the first  position of  the next
  1664.                     line).
  1665.  
  1666.                  Ex:   Write    "Enter your password ",0,7
  1667.                        Variable ErrMsg1,25,"Invalid directory name."
  1668.                        Variable ErrClr,3,112
  1669.                        Write    ErrMsg1,ErrClr
  1670.  
  1671.             WRITEAT    VarName1, VarName2, VarName3 [,VarName4] [,VarName5]
  1672.             (46)       Literal1, Literal2, Literal3 [,Literal4] [,Literal5]
  1673.                  Write   the  string  contained  in  VarName3  at  column  (X)
  1674.                     contained  in VarName1  and row (Y)  contained in VarName2
  1675.                     using   the  foreground   color  attribute   contained  in
  1676.                     VarName4  and the background color  attribute contained in
  1677.                     VarName5.  In the  absence of  VarName4 and  VarName5, use
  1678.                     the  current color  attributes. The string is not followed
  1679.                     by  a carriage  return, line feed  pair (ie the  cursor is
  1680.                     not moved to the first position of the next line).
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.             Page 30                     PowerBatch                     Page 30
  1689.  
  1690.                  Ex:   Variable TitleClr,3,112
  1691.                        Variable CurrX,2
  1692.                        Variable CurrY,2
  1693.                        Variable CompName,25,"The ABC Company"
  1694.                        WriteAt  15,3,"The ABC Company",TitleClr
  1695.                        WriteAt  CurrX,CurrY,CompName
  1696.  
  1697.                     In  the first  usage of  the WriteAt  command  the literal
  1698.                        "The  ABC Company"  is written at column  15, row 3. In
  1699.                        the  second  usage,   the  contents  of  the   variable
  1700.                        CompName  ("The ABC Company")  is written at the column
  1701.                        location  specified by  the contents of  variable CurrX
  1702.                        and at  the row location specified  by the contents  of
  1703.                        variable CurrY.
  1704.  
  1705.             WRITELINE  VarName1 [,VarName2]
  1706.             (195)
  1707.                  Write  the string contained in VarName1 beginning in location
  1708.                     1 of  the line  number specified  in VarName2. Follow  the
  1709.                     string  with a carriage return line feed pair (ie move the
  1710.                     cursor  to the  first position of  the next line).  In the
  1711.                     absence  of  VarName2  write the  string  at  the  current
  1712.                     cursor location.
  1713.  
  1714.                  Ex:   WriteLine   "Please read these instructions ",7
  1715.                        WriteLine   Msg5
  1716.  
  1717.                     In the  first usage of  WriteLine the message "Please read
  1718.                        these  instructions " is  written beginning in column 1
  1719.                        of  row  7. In  the second  usage the  contents of  the
  1720.                        variable  Msg5  is written  beginning  at  the  current
  1721.                        cursor  location. In both cases a carriage return, line
  1722.                        feed  (position  cursor at  the first  position of  the
  1723.                        next line) is written.
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.             Page 31                     PowerBatch                     Page 31
  1732.  
  1733.                                      Command Summary
  1734.  
  1735.             ?COLOR        Var1, Var2, Var3 
  1736.             ?CURRDIR      Var1, Var2
  1737.             ?DATE         Var1, Var2, Var3, Var4
  1738.             ?DIREXIST     Var1, Lab1 [,Lab2]  or Lit1, Lab1 [,Lab2]
  1739.             ?DISKSPACE    Var1, Var2, Var3
  1740.             ?DRIVEEXIST   Var1, Lab1 [,Lab2] or Lit1, Lab1 [,Lab2]
  1741.             ?ENVSTR       Var1, Var2 or Lit1, Var2
  1742.             ?FILEEXIST    Var1, Lab1 [,Lab2] or Lit1, Lab1 [,Lab2]
  1743.             ?INPATH       Var1, Lab1 [,Lab2] or Lit1, Lab1 [,Lab2]
  1744.             ?TIME         Var1
  1745.             BEEP          Var1, Var2, Var3 or Lit1, Lit2, Lit3
  1746.             BLINK
  1747.             BOX1          Var1,  Var2, Var3,  Var4, Var5 [,V6]  or Lit1, Lit2,
  1748.                           Lit3, Lit4, Lit5, [,Lit6]
  1749.             BREAKON
  1750.             BREAKOFF
  1751.             CENTER        Var1, Var2 or Lit1, Lit2
  1752.             CLEAR         Var1 [,Var2] or Lit1 [,Lit2]
  1753.             CLEARBOX      Var1,  Var2, Var3,  Var4, Var5 [,V6]  or Lit1, Lit2,
  1754.                           Lit3, Lit4, Lit5 [,Lit6]
  1755.             CLEARLINE     Var1, Var2 [,Var3] or Lit1, Lit2, Lit3
  1756.             COLOR         Var1 [,Var2] or Lit1 [,Lit2]
  1757.             COMPARE       Var1,  Var2, Lab1  [,Lab2]  [,Lab3]  or Lit1,  Lit2,
  1758.                           Lab1 [,Lab2] [,Lab3]
  1759.             CONCAT        Var1, Var2 [,Var3] or Var1, Lit2 [,Lit3]
  1760.             GOTO          Lab1
  1761.             LENGTH        Var1, Var2 or Var1, Lit1
  1762.             LOWER         Var1 
  1763.             MIDSTRING     Var1, Var2, Var3, Var4 or Var1, Var2, Lit1, Lit2
  1764.             NORMAL
  1765.             PROMPT        Var1 or Lit1
  1766.             READKEY       Var1
  1767.             READSTR       Var1
  1768.             READUPKEY     Var1
  1769.             READYN        Var1, Var2 or Lit1, Var1
  1770.             REVERSE
  1771.             SETENV        Var1, Var2 or Lit1, Lit2
  1772.             SETPATH       Var1 or Lit1
  1773.             SETVAR        Var1, Var2 or Var1, Lit1
  1774.             UPPER         Var1
  1775.             VARIABLE      VariableName, MaxLength [,InitialValue]
  1776.             WAIT          Var1 or Lit1
  1777.             WRITE         Var1, Var2 [,Var3] or Lit1, Lit2 [,Lit2]
  1778.             WRITEAT       Var1,  Var2, Var3  [,Var4]  [,Var5]  or Lit1,  Lit2,
  1779.                           Lit3, [,Lit4] [,Lit5]
  1780.             WRITELINE     Var1 [,Var2] or Lit1 [,Lit2]
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.             Page 32                     PowerBatch                     Page 32
  1789.  
  1790.             ERRORLEVEL    Predefined  variable  containing the  value  of  the
  1791.                           exit code set by the previous program or command.
  1792.  
  1793.             DOSERROR      Predefined variable  containing the  last set  value
  1794.                           of the operating system error code.
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.             Page 33                     PowerBatch                     Page 33
  1803.  
  1804.                                     Compilation Errors
  1805.  
  1806.             Compilation  errors are printed on  the screen and also written in
  1807.             a  file named  POWERBAT.ERR (If  you have  a split  screen editor,
  1808.             view  the source  in one screen part  and the errors  in the other
  1809.             part).  If  the  source line  is  available,  the source  line  is
  1810.             printed  above the error preceded by the line number count. Source
  1811.             lines  are not  available during the  second pass of  the compiler
  1812.             which may generate "Label not defined" and "Variable not  defined"
  1813.             errors.
  1814.  
  1815.               "Not a valid command" -  This error is generated  when the first
  1816.                  word  on the  command line  is not  a PowerBatch  command and
  1817.                  contains more than 8 characters.
  1818.  
  1819.                  Example:
  1820.                     13 Directory name checked here.
  1821.                     [DIRECTORY] Not a valid command
  1822.  
  1823.                     Probably should be ;Directory name checked here
  1824.  
  1825.               "Missing variable" -  A command contains less than the  required
  1826.                  number of operands.
  1827.  
  1828.                  Example:
  1829.                     21 ?Color   ForeColor,BackColor
  1830.                     [] Missing variable
  1831.  
  1832.                     Variable for the composite color byte is missing.
  1833.  
  1834.               "Expected a variable  Name" - A string  was found in an  operand
  1835.                  that may contain only a variable name.
  1836.  
  1837.                  Example:
  1838.                     10 ?Time "Current Time"
  1839.                     [Current Time] Expected a variable name
  1840.  
  1841.                     The current time may only be placed in a variable.
  1842.  
  1843.               "Quoted   literal  not   terminated"  -   A  single   quote  was
  1844.                  encountered within a source line.
  1845.  
  1846.                  Example:
  1847.                     9 Center "Move Command,5
  1848.                     [] Quoted literal not terminated
  1849.  
  1850.                     Closing quote should precede comma.
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.             Page 34                     PowerBatch                     Page 34
  1859.  
  1860.               "Invalid  max  length  specified"  -  The second  operand  of  a
  1861.                  variable  definition should specify the maximum length of the
  1862.                  variable. The value found was not numeric.
  1863.  
  1864.                  Example:
  1865.                     3 Variable  CompName,"The ABC Company"
  1866.                     [The ABC Company] Invalid max length specified
  1867.  
  1868.               "Variable not defined" -  A reference to a variable was made  in
  1869.                  the  source file  but the variable  was not defined  with the
  1870.                  Variable command.
  1871.  
  1872.                  Example:
  1873.                     [CURRDATE] Variable not defined
  1874.  
  1875.               "Duplicate  variable" - The same variable name has appeared 2 or
  1876.                  more times in a Variable definition statement.
  1877.  
  1878.                  Example:
  1879.                     7 Variable  CompName,25
  1880.                     [COMPNAME] Duplicate variable
  1881.  
  1882.               "Duplicate label" - The same  label name has appeared  2 or more
  1883.                  times in a Label definition statement.
  1884.  
  1885.                  Example:
  1886.                     16 Label    Step2
  1887.                     [STEP2] Duplicate label
  1888.  
  1889.               "External command >" - This  is not an error  message, but is  a
  1890.                  check  to alert  you to  each command  found in  a PowerBatch
  1891.                  source  file  that will  be treated  as an  external command.
  1892.                  External  commands are DOS intrinsic commands, .COM, and .EXE
  1893.                  commands or programs (even PowerBatch  compiled programs) and
  1894.                  .BAT  (standard DOS  batch files) that are  to be executed by
  1895.                  PowerBatch.
  1896.  
  1897.                  Example:
  1898.                     External command > 12 DIR     (DOS directory command)
  1899.                     External command > 29 MYPROG  (Executable module MYPROG)
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.             Page 35                     PowerBatch                     Page 35
  1908.  
  1909.                            Removing PowerBatch From Your System
  1910.  
  1911.             While  we  believe  that  PowerBatch  is  a  batch  compiler  that
  1912.             everyone should own, we recognize that there are some who feel  it
  1913.             is not a  program they will use on  a regular basis. For those  of
  1914.             you in that minority,  we have provided a program to easily remove
  1915.             all PowerBatch modules  from your  system. To  remove all  modules
  1916.             from  your system  that were  supplied on  the  PowerBatch install
  1917.             disk, enter
  1918.  
  1919.               DELETEPB <enter>
  1920.  
  1921.             You  will be asked  if you wish  to remove  all PowerBatch modules
  1922.             from  the  currently logged  disk. If  this is  the correct  disk,
  1923.             enter Y. If it is  not the correct disk, enter  N and the  program
  1924.             will  terminate. (You  should  move  to  the disk  containing  the
  1925.             PowerBatch  modules.)  You  will next  be  asked  if you  wish  to
  1926.             confirm  each deletion. If you reply (Y)es, each time a PowerBatch
  1927.             module is found,  you will  be asked  if you  wish to delete  this
  1928.             module. If  you reply (N)o,  the modules will  be deleted as  they
  1929.             are found without your intervention.
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.             Page 36                     PowerBatch                     Page 36
  1938.  
  1939.                                          Examples
  1940.  
  1941.             The source for  these examples is  contained on  your installation
  1942.             disk. These examples may be compiled using the POWERMAK command.
  1943.  
  1944.             Example:      POWERMAK DEMO1 <enter>
  1945.  
  1946.                                           DEMO1
  1947.  
  1948.             This  listing  for  DEMO1  contains  line  numbers  preceding  the
  1949.             PowerBatch  command. These line numbers are for reference purposes
  1950.             within the  documentation and  are not  contained  in the  source.
  1951.             Line numbers are in fact not allowed in any PowerBat source file.
  1952.  
  1953.                1     Variable          Fore,1           ;save area for initial
  1954.             colors
  1955.                2    Variable        Back,1
  1956.                3    Variable        ColorAttr,1
  1957.                4    Variable        CharIn,1      ;for user responses
  1958.                5    Variable        RedOnGray,3,116
  1959.                6    Variable        RedOnBlack,3,4
  1960.                7    Variable        YelOnBlue,3,30
  1961.                8    Variable        YelOnGray,3,126
  1962.                9    Variable        BlueOnGray,3,113
  1963.               10    Variable        DOW,9                ;for date command
  1964.               11    Variable        Mo,2
  1965.               12    Variable        Da,2
  1966.               13    Variable        Yr,4
  1967.               14    Variable        CurrTime,11   ;for current time
  1968.               15    Variable        DirName,78    ;for user entered dir name
  1969.               16    Variable        FileName,78   ;for user entered file name
  1970.               17    Variable         Space35,35,"                             
  1971.                 "
  1972.               18    Variable        Space76,76,"                              
  1973.                                                          "
  1974.               19    Variable        TotSpace,10
  1975.               20    Variable        AvailSpace,10
  1976.               21    Variable        Msg,78
  1977.               22    Variable        Msg2,78
  1978.               23    Variable        FName,35
  1979.               24    Variable        LName,35
  1980.               25    ?Color          Fore,Back,ColorAttr  ;initial color
  1981.               26    ?Date           DOW,Mo,Da,Yr         ;get system date
  1982.               27    ?Time           CurrTime             ;get system time
  1983.               28    Clear
  1984.               29      ReadYN             "Do  you have a  color monitor? [Y/N]
  1985.             ",CharIn
  1986.               30    Compare         CharIn,"Y",,,ColorMon
  1987.               31    SetVar          RedOnGray,112
  1988.               32    SetVar          YelOnBlue,7
  1989.               33    SetVar          BlueOnGray,7
  1990.               34    Label           ColorMon
  1991.  
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.  
  1998.             Page 37                     PowerBatch                     Page 37
  1999.  
  2000.               35    Clear           BlueOnGray           ;clear to my color
  2001.               36    Box1            2,10,79,25,YelOnGray ;info box border
  2002.               37    ClearBox        2,10,79,25,YelOnBlue ;     interior
  2003.               38    Color           RedOnGray
  2004.               39    Box1            24,1,56,5,RedOnGray  ;title box
  2005.               40    ClearBox        24,1,56,5,RedOnBlack
  2006.               41    Color           RedOnBlack
  2007.               42    Center          "POWERBATCH",2
  2008.               43    Center          "By",3
  2009.               44    Center          "Computing Systems Design, Inc.",4
  2010.               45    Color           YelOnBlue
  2011.               46    WriteAt         3,11,"PowerBatch is  a power batch utility
  2012.             that produces COMPILED batch files."
  2013.               47     WriteAt         3,12,"With PowerBatch you can perform all
  2014.             standard DOS batch functions, plus"
  2015.               48     WriteAt           3,13,"use the  35 additional PowerBatch
  2016.             commands to create batch files with POWER."
  2017.               49      WriteAt            3,15,"PowerBatch compiles  your batch
  2018.             commands and produces a standalone .EXE"
  2019.               50     WriteAt            3,16,"module that  executes at the top
  2020.             speed of your computer. This information"
  2021.               51    WriteAt           3,17,"and demonstration program  you are
  2022.             now running is a compiled PowerBatch"
  2023.               52     WriteAt           3,18,"program  (the included  source is
  2024.             DEMO1.PWR). PowerBatch is especially"
  2025.               53       WriteAt             3,19,"powerful  for screen  related
  2026.             functions. Draw boxes, write to the screen with"
  2027.               54     WriteAt         3,20,"blazing speed,  control text colors
  2028.             with ease, get input from the user, make"
  2029.               55       WriteAt             3,21,"data  comparisions and  logic
  2030.             branches, and access system information with"
  2031.               56     WriteAt          3,22,"single commands. Follow this  tour
  2032.             of the power in PowerBatch."
  2033.               57    GoToXY          26,24
  2034.               58    Write           "Press any key to continue...",RedOnGray
  2035.               59    ReadKey         CharIn
  2036.               60    ClearBox        2,10,79,25,YelOnBlue
  2037.               61     WriteAt          3,11,"PowerBatch gives you access to the
  2038.             system date and time and makes these"
  2039.               62    WriteAt         3,12,"available as variables for your  use
  2040.             in screen writes."
  2041.               63     WriteAt         3,14,"The system date is returned in four
  2042.             variables of your choice. In these"
  2043.               64    GoToXY          3,15
  2044.               65    Write           "variables are placed Day of the week ("
  2045.               66    Write           DOW
  2046.               67    Write           ") Month number ("
  2047.               68    Write           Mo
  2048.               69    Write           "),"
  2049.               70    GoToXY          3,16
  2050.               71    Write           "Day number ("
  2051.               72    Write           Da
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.             Page 38                     PowerBatch                     Page 38
  2060.  
  2061.               73    Write           "), and Year number ("
  2062.               74    Write           Yr
  2063.               75    Write           ")."
  2064.               76     WriteAt          3,18,"In a  like manner the current time
  2065.             may be retrieved into a variable of your"
  2066.               77    WriteAt         3,19,"choice, and used any way you wish."
  2067.               78    WriteAt         3,21,"Current time is "
  2068.               79    WriteAt         19,21,CurrTime
  2069.               80    GoToXY          26,24
  2070.               81    Color           YelOnBlue
  2071.               82    Blink
  2072.               83    Write           "Press any key to continue..."
  2073.               84    Normal
  2074.               85    ReadKey         CharIn
  2075.               86    ClearBox        2,10,79,25,YelOnBlue
  2076.               87    WriteAt           3,11,"PowerBatch also provides  you with
  2077.             several input commands to retrieve both"
  2078.               88     WriteAt           3,12,"data and question responses  from
  2079.             the user. Commands are provided to retrieve"
  2080.               89     WriteAt           3,13,"one  key (and one key only), read
  2081.             one key in upper case, read either Y or N"
  2082.               90    WriteAt          3,14,"for Yes/No responses, and to read a
  2083.             string of a specified length."
  2084.               91    GoToXY          3,15
  2085.               92    Write           "Enter one character in lower case [ ]"
  2086.               93    GoToXY          38,15
  2087.               94    ReadKey         CharIn
  2088.               95    GoToXY          41,15
  2089.               96    Write           "You can manipulate the case "
  2090.               97    GoToXY          3,16
  2091.               98    Write            "of the data entered changing from  lower
  2092.             ["
  2093.               99    Write           CharIn
  2094.              100    Write           "] to upper ["
  2095.              101    Upper           CharIn
  2096.              102    Write           CharIn
  2097.              103    Write           "] to lower ["
  2098.              104    Lower           CharIn
  2099.              105    Write           CharIn
  2100.              106    Write           "]."
  2101.              107     WriteAt            3,18,"PowerBatch also  contains strong
  2102.             string manipulation commands."
  2103.              108    WriteAt         3,19,"Enter your last name "
  2104.              109    ReadStr         LName
  2105.              110    WriteAt         14,19,Space35
  2106.              111    WriteAt         14,19,"first name "
  2107.              112    ReadStr         FName
  2108.              113    WriteAt         3,19,Space35
  2109.              114    Midstring       Msg,FName,1,3
  2110.              115    Midstring       Msg2,LName,1,3
  2111.              116    Concat          Msg," "
  2112.              117    Concat          Msg,Msg2
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.             Page 39                     PowerBatch                     Page 39
  2121.  
  2122.              118    WriteAt         3,20,Msg
  2123.              119    Wait            10
  2124.              120    Midstring       Msg,FName,1,6
  2125.              121    Midstring       Msg2,LName,1,6
  2126.              122    Concat          Msg," "
  2127.              123    Concat          Msg,Msg2
  2128.              124    WriteAt         3,20,Msg
  2129.              125    Wait            10
  2130.              126    Concat          Msg,FName," "
  2131.              127    Concat          Msg,LName
  2132.              128    WriteAt         3,20,Msg
  2133.              129    Length          Msg2,Msg
  2134.              130      Concat            Msg,"The length of  this name field is
  2135.             ",Msg2
  2136.              131    WriteAt         3,21,Msg
  2137.              132    GoToXY          26,24
  2138.              133    Write           "Press any key to continue...",RedOnGray
  2139.              134    ReadKey         CharIn
  2140.              135    ClearBox        2,10,79,25,YelOnBlue
  2141.              136    WriteAt          3,11,"PowerBatch gives you the capability
  2142.             to verify drives, directories, or file"
  2143.              137    WriteAt          3,12,"names entered by the user. You  may
  2144.             execute selected portions of the batch"
  2145.              138     WriteAt            3,13,"file based  on the existance  or
  2146.             non-existance of these entries."
  2147.              139    Label           ChekDrive
  2148.              140    GoToXY          3,15
  2149.              141    Write           "Enter a drive letter to be verified"
  2150.              142    Write           Space35
  2151.              143    GoToXY          39,15
  2152.              144    ReadUpKey       CharIn
  2153.              145    ?DriveExist     CharIn,GoodDrive
  2154.              146    Blink
  2155.              147     WriteAt           3,24,"That is not a valid drive in your
  2156.             system. Please re-enter."
  2157.              148    Normal
  2158.              149    Beep            750,8
  2159.              150    Wait            30
  2160.              151    WriteAt         3,24,Space76
  2161.              152    GoTo            ChekDrive
  2162.              153    Label           GoodDrive
  2163.              154    GoToXY          3,16
  2164.              155    Write           "Enter a directory name to be verified"
  2165.              156    Write           Space35
  2166.              157    GoToXY          41,16
  2167.              158    ReadStr         DirName
  2168.              159    ?DirExist       DirName,GoodDir
  2169.              160    Blink
  2170.              161    WriteAt           3,24,"That is not  a valid directory  in
  2171.             your system. Please re-enter."
  2172.              162    Normal
  2173.              163    Wait            30
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.             Page 40                     PowerBatch                     Page 40
  2182.  
  2183.              164    WriteAt         3,24,Space76
  2184.              165    GoTo            GoodDrive
  2185.              166    Label           GoodDir
  2186.              167    GoToXY          3,17
  2187.              168    Write           "Enter a file name to be verified"
  2188.              169    Write           Space35
  2189.              170    GoToXY          36,17
  2190.              171    ReadStr         FileName
  2191.              172    ?FileExist      FileName,GoodFile
  2192.              173    Blink
  2193.              174     WriteAt           3,24,"That is not  a valid filename  in
  2194.             your system. Please re-enter."
  2195.              175    Normal
  2196.              176    Wait            30
  2197.              177    WriteAt         3,24,Space76
  2198.              178    GoTo            GoodDir
  2199.              179    Label           GoodFile
  2200.              180    WriteAt          3,18,"PowerBatch can  query your disk for
  2201.             total space and available space"
  2202.              181     WriteAt            3,19,"Drive [  ] capacities are (enter
  2203.             drive letter)"
  2204.              182    GoToXy          10,19
  2205.              183    ReadUpKey       CharIn
  2206.              184    ?DiskSpace      CharIn,TotSpace,AvailSpace
  2207.              185    Concat          Msg,CharIn," has "
  2208.              186    Concat          Msg,AvailSpace
  2209.              187    Concat          Msg," bytes available of the total "
  2210.              188    Concat          Msg,TotSpace
  2211.              189    Concat          Msg," bytes"
  2212.              190    WriteAt         9,19,Msg
  2213.              191    GoToXY          26,24
  2214.              192    Write           "Press any key to continue...",RedOnGray
  2215.              193    ReadKey         CharIn
  2216.              194    Clear
  2217.              195     WriteLine       "PowerBatch can run any valid DOS command
  2218.             that may be inserted in a batch file."
  2219.              196     WriteLine        "For example, here is  a listing of your
  2220.             current directory..."
  2221.              197    Wait            30
  2222.              198    Clear           ColorAttr     ;clear to default color
  2223.              199    Dir             "/w"
  2224.              200    Wait            30
  2225.              201    Color           YelOnBlue
  2226.              202    Clear
  2227.              203     WriteLine          "PowerBatch can also run  (and return)
  2228.             other PowerBatch programs, giving you a "
  2229.              204       WriteLine          "subroutine  capability. It  has the
  2230.             capability to re-boot the system (which I"
  2231.              205    WriteLine       "will NOT demonstrate here."
  2232.              206    GoToXY          1,5
  2233.              207    WriteLine        "The purpose of  this demonstration is to
  2234.             not only show you the capabilities"
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.             Page 41                     PowerBatch                     Page 41
  2243.  
  2244.              208     WriteLine        "of  PowerBatch, but to let you  compare
  2245.             the source with the running version"
  2246.              209      WriteLine         "of this  program and  aid you  in the
  2247.             development of your own PowerBatch"
  2248.              210    WriteLine       "programs."
  2249.              211    GoToXY          1,10
  2250.              212    Write           "Press any key to continue..."
  2251.              213    ReadKey         CharIn
  2252.              214    Color           ColorAttr     ;reset original colors
  2253.              215    Clear
  2254.              216    Box1            24,1,56,5,ColorAttr
  2255.              217    Center          "POWERBATCH",2
  2256.              218    Center          "By",3
  2257.              219    Center          "Computing Systems Design, Inc.",4
  2258.              220    GoToXy          1,24
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.             Page 42                     PowerBatch                     Page 42
  2267.  
  2268.                                           MOVE1
  2269.  
  2270.             Variable        CLP%1,79,"a"          ;command line parm %1
  2271.             Variable        CLP%2,79,"a"          ;%2
  2272.             Variable        InChar,1              ;for keyboard responses
  2273.             Compare         CLP%1,"a",,,Syntax    ;show syntax
  2274.             Compare         CLP%2,"a",,,Syntax
  2275.             Clear                                 ;clear the screen
  2276.             Upper           CLP%1                 ;make CLP%1 upper case
  2277.             Upper           CLP%2                 ;make CLP%2 upper case
  2278.             Write           "Move "               ;build initial msg
  2279.             Write           CLP%1
  2280.             Write           " to "
  2281.             WriteLine       CLP%2
  2282.             ?FileExist      CLP%1,File1OK         ;does source file exist
  2283.             Write           CLP%1                 ;write error msg
  2284.             WriteLine       " not found."
  2285.             GoTo            BadCopy
  2286.             Label           File1OK
  2287.             ?FileExist         CLP%2,,File2OK          ;does  destination file
  2288.             exist
  2289.             Write           CLP%2                 ;write error msg
  2290.             WriteLine       " exists!"
  2291.             ReadYN          "Overwrite? [Y/N] ",InChar
  2292.             WriteLine       ""
  2293.             Compare         InChar,"N",,,BadCopy
  2294.             Label           File2OK
  2295.             Compare         CLP%1,CLP%2,,,DupFiles ;cannot copy to itself
  2296.             Copy            CLP%1 CLP%2            ;DOS copy command
  2297.             ?FileExist       CLP%2,,BadCopy          ;did  output file make it
  2298.             OK
  2299.             Write           "Erasing "             ;tell user erasing source
  2300.             WriteLine       CLP%1
  2301.             Erase           CLP%1                  ;DOS erase command
  2302.             WriteLine       "Move successful"      ;msg to user
  2303.             Halt
  2304.             Label           DupFiles
  2305.             WriteLine       "Cannot move a file to itself"
  2306.             Label            BadCopy                   ;unsuccessful comes  to
  2307.             here
  2308.             WriteLine       "Move unsuccessful"
  2309.             Halt
  2310.             Label           Syntax
  2311.             WriteLine       "Syntax is Move1 SourceFileName TargetFileName"
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.             Page 43                     PowerBatch                     Page 43
  2320.  
  2321.                                           MOVE2
  2322.  
  2323.             Variable        CLP%1,79,"a"           ;command line parm %1
  2324.             Variable        CLP%2,79,"a"           ;%2
  2325.             Variable        InChar,1               ;for keyboard responses
  2326.             Compare         CLP%1,"a",,,Syntax     ;show syntax
  2327.             Compare         CLP%2,"a",,,Syntax
  2328.             Clear                                  ;clear the screen
  2329.             Upper           CLP%1                  ;make CLP%1 upper case
  2330.             Upper           CLP%2                  ;make CLP%2 upper case
  2331.             Write           "Move "                ;build initial msg
  2332.             Write           CLP%1
  2333.             Write           " to "
  2334.             WriteLine       CLP%2
  2335.             Label           ChkFile1
  2336.             ?FileExist      CLP%1,File1OK          ;does source file exist
  2337.             Blink                                     ;if not make screen text
  2338.             blink
  2339.             Write           CLP%1                  ;write error msg
  2340.             WriteLine       " not found."
  2341.             Normal                                 ;set text to normal
  2342.             Write           "Enter source file name : " ;prompt user for name
  2343.             ReadStr         CLP%1
  2344.             GoTo            ChkFile1
  2345.             Label           File1OK                ;check new name for exists
  2346.             ?FileExist        CLP%2,,File2OK           ;does  destination file
  2347.             exist
  2348.             Blink                                  ;if not then text to blink
  2349.             Write           CLP%2                  ;write error message
  2350.             WriteLine       " exists!"
  2351.             Normal                                 ;set text to normal
  2352.             ReadYN          "Overwrite? [Y/N] ",InChar      ;query user
  2353.             WriteLine       ""
  2354.             Compare         InChar,"N",,,BadCopy   ;if user entered "Y"  exit
  2355.             Label           File2OK                ;come here if all OK
  2356.             Compare         CLP%1,CLP%2,,,DupFiles ;cannot copy to itself
  2357.             Copy            CLP%1 CLP%2            ;DOS copy command
  2358.             ?FileExist      CLP%2,,BadCopy         ;is output file OK
  2359.             Reverse                                ;make text reverse video
  2360.             Write           "Erasing "             ;write erase message
  2361.             WriteLine       CLP%1
  2362.             Normal                                 ;set text back to normal
  2363.             Erase           CLP%1                  ;DOS erase command
  2364.             WriteLine       "Move successful"      ;tell user all is OK
  2365.             Halt
  2366.             Label           DupFiles
  2367.             WriteLine       "Cannot move a file to itself"
  2368.             Label           BadCopy
  2369.             WriteLine       "Move unsuccessful"
  2370.             Label           Syntax
  2371.             WriteLine       "Syntax is Move1 SourceFileName TargetFileName"
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.             Page 44                     PowerBatch                     Page 44
  2380.  
  2381.                                           MENU1
  2382.  
  2383.             Variable        FColor,1                 ;store the current screen
  2384.             colors
  2385.             Variable      BColor,1
  2386.             Variable      ColorAttr,1
  2387.             Variable      MenuSel,1
  2388.             ?Color        FColor,BColor,ColorAttr
  2389.             Label         ShowMenu
  2390.             Clear         112                  ;clear screen to a new color
  2391.             Center        "Demonstration Menu",2    ;center on line 2
  2392.             WriteAt       10,4,"A. Run a directory and return"
  2393.             WriteAt           10,6,"B.  Run BoxDemo  and return  (DOS batch  +
  2394.             PowerBatch + return)"
  2395.             WriteAt       10,8,"C. Reboot your system"
  2396.             WriteAt       10,10,"E. Exit this menu and return to DOS"
  2397.             Label         GetInp
  2398.             WriteAt       15,13,"Enter your choice :"
  2399.             GoToXY        34,13
  2400.             ReadUpKey     MenuSel                   ;get users selection
  2401.             Compare       MenuSel,"A",ChekB,Error   ;compare selection to A
  2402.             Clear          7,0                   ;clear screen to fore 7, back
  2403.             0
  2404.             dir           "/w"                 ;run DOS dir cmd with /w parm
  2405.             Wait          30                        ;wait 3 secs for show
  2406.             GoTo          ShowMenu                  ;redisplay menu
  2407.             Label         ChekB
  2408.             Compare       MenuSel,"B",ChekC,Error   ;compare selection to B
  2409.             Clear         15                   ;clear screen to attribute 15
  2410.             DOSEX1                                  ;run a DOS  batch file   &
  2411.             PowerBatch program
  2412.             Wait          30                   ;wait 3 secs
  2413.             GoTo          ShowMenu             ;redisplay menu
  2414.             Label         ChekC
  2415.             Compare       MenuSel,"C",ChekE,Error   ;compare selection to C
  2416.             Boot                                    ;perform a warm boot
  2417.             Label         ChekE
  2418.             Compare       MenuSel,"E",Error,Error   ;compare selection to E
  2419.             Clear         ColorAttr                 ;restore original color
  2420.             Halt                                           ;end the PowerBatch
  2421.             program
  2422.             Label         Error                     ;come here for errors
  2423.             Blink                                   ;reverse the colors
  2424.             WriteAt       5,20,"InCorrect menu selection...Try again."
  2425.             Beep          750,5                ;beep at 750 hz for half sec
  2426.             Wait          30                        ;wait 3 secs to see msg
  2427.             Normal                                  ;restore text attributes
  2428.             ClearLine     20                        ;clear the message line
  2429.             GoToXY        34,13                     ;erase the wrong entry
  2430.             Write         " "
  2431.             GoTo          GetInp                    ;get new menu selection
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.             Page 45                     PowerBatch                     Page 45
  2440.  
  2441.                                          BOXDEMO2
  2442.  
  2443.             Variable    FColor,1
  2444.             Variable    BColor,1
  2445.             Variable    ColorAttr,1
  2446.             Variable    Clr1,3,30
  2447.             Variable    Clr2,3,46
  2448.             Variable    Clr3,3,62
  2449.             Variable    Clr4,3,78
  2450.             Variable    Clr5,3,94
  2451.             Variable    Clr6,3,110
  2452.             Variable    InChar,1
  2453.             ?Color      FColor,BColor,ColorAttr           ;save curr colors
  2454.             Clear       Clr1                         ;clear screen to color 1
  2455.             Label       MonType
  2456.             GoToXY      1,20
  2457.             ReadYN      "Do you have a color monitor? [Y/N] ",InChar
  2458.             Compare     InChar,"N",ColorsOK
  2459.             SetVar      Clr1,7                       ;reset colors for mono
  2460.             SetVar      Clr2,112
  2461.             SetVar      Clr3,112
  2462.             SetVar      Clr4,112
  2463.             SetVar      Clr5,112
  2464.             SetVar      Clr6,112
  2465.             Label       ColorsOK
  2466.             Clear       Clr1                              ;clear screen
  2467.             Box1         15,7,66,18,Clr1               ;draw center box, color
  2468.             1
  2469.             WriteAt         16,8,"Drawing  boxes  (or  frames)  around  screen
  2470.             displays"
  2471.             WriteAt         17,9,"seems  to add  a  finishing touch  to menus,
  2472.             messages"
  2473.             WriteAt        17,10,"or  any other  information  conveyed to  the
  2474.             user."
  2475.             WriteAt        16,12,"With  a  batch file,  not  only is  it  time
  2476.             consuming,"
  2477.             WriteAt         17,13,"but  painfully slow.  Most  of the  time it
  2478.             simply"
  2479.             WriteAt     17,14,"is not worth the trouble."
  2480.             WriteAt     16,16,"With PowerBatch, you draw your frame with one"
  2481.             WriteAt     17,17,"command. And it is a little faster..."
  2482.             Box1        2,1,14,6,Clr1                ;draw boxes around perif
  2483.             Box1        2,7,14,12,Clr1
  2484.             Box1        2,13,14,18,Clr1
  2485.             Box1        2,19,14,24,Clr1
  2486.             Box1        15,19,27,24,Clr1
  2487.             Box1        28,19,40,24,Clr1
  2488.             Box1        41,19,53,24,Clr1
  2489.             Box1        54,19,66,24,Clr1
  2490.             Box1        67,19,79,24,Clr1
  2491.             Box1        67,13,79,18,Clr1
  2492.             Box1        67,7,79,12,Clr1
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.             Page 46                     PowerBatch                     Page 46
  2501.  
  2502.             Box1        67,1,79,6,Clr1
  2503.             Box1        54,1,66,6,Clr1
  2504.             Box1        41,1,53,6,Clr1
  2505.             Box1        28,1,40,6,Clr1
  2506.             Box1        15,1,27,6,Clr1
  2507.             wait        30                                  ;wait 3 secs
  2508.             ClearBox    2,1,14,6,Clr6             ;clear boxes to diff colors
  2509.             ClearBox    2,7,14,12,Clr2
  2510.             ClearBox    2,13,14,18,Clr3
  2511.             ClearBox    2,19,14,24,Clr4
  2512.             ClearBox    15,19,27,24,Clr5
  2513.             ClearBox    28,19,40,24,Clr6
  2514.             ClearBox    41,19,53,24,Clr2
  2515.             ClearBox    54,19,66,24,Clr3
  2516.             ClearBox    67,19,79,24,Clr4
  2517.             ClearBox    67,13,79,18,Clr5
  2518.             ClearBox    67,7,79,12,Clr6
  2519.             ClearBox    67,1,79,6,Clr2
  2520.             ClearBox    54,1,66,6,Clr3
  2521.             ClearBox    41,1,53,6,Clr4
  2522.             ClearBox    28,1,40,6,Clr5
  2523.             ClearBox    15,1,27,6,Clr6
  2524.             Wait        30
  2525.             ClearBox    28,19,40,24,Clr1
  2526.             ClearBox    28,1,40,6,Clr1
  2527.             ClearBox    2,19,14,24,Clr1
  2528.             ClearBox    54,1,66,6,Clr1
  2529.             ClearBox    67,1,79,6,Clr1
  2530.             ClearBox    67,7,79,12,Clr1
  2531.             ClearBox    67,13,79,18,Clr1
  2532.             ClearBox    67,19,79,24,Clr1
  2533.             ClearBox    54,19,66,24,Clr1
  2534.             ClearBox    15,19,27,24,Clr1
  2535.             ClearBox    15,1,27,6,Clr1
  2536.             ClearBox    2,13,14,18,Clr1
  2537.             ClearBox    2,7,14,12,Clr1
  2538.             ClearBox    41,1,53,6,Clr1
  2539.             ClearBox    41,19,53,24,Clr1
  2540.             ClearBox     2,1,14,6,Clr1                   ;clear boxes  to diff
  2541.             colors
  2542.             WriteAt     1,25,"Press any key to exit"
  2543.             GoToXY      23,25                      ;position cursor after msg
  2544.             ReadKey      InChar                        ;wait for user to press
  2545.             key
  2546.             Clear         ColorAttr                      ;clear screen to orig
  2547.             color
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.             Page 47                     PowerBatch                     Page 47
  2556.  
  2557.                                           Index
  2558.  
  2559.      ASP  1                                    ?INPATH  19
  2560.      Box  20                                   ?TIME  19
  2561.      Case                                      ADD  19
  2562.            lower  25                           BEEP  19
  2563.            upper  27, 28                       BLINK  20
  2564.      Color attribute  16, 25                   BOX  20
  2565.      Command line parameters  29               BREAKOFF  21
  2566.      Command Summary  31                       BREAKON  21
  2567.      Command Syntax  16                        CENTER  21
  2568.      Comments  10                              CLEAR  21
  2569.      Compare                                   CLEARBOX  21
  2570.            alphabetic  23                      CLEARLINE  22
  2571.            numeric  23                         COLOR  22
  2572.      Compilation Errors  33                    COMPARE  22
  2573.      Concatenate  24                           CONCAT  24
  2574.      Concept Of Operation  5                   GOTO  24
  2575.      Copyright  1                              GOTOXY  24
  2576.      Ctrl - Break  21                          HALT  25
  2577.      Current date  17                          LABEL  25
  2578.      Current time  19                          LENGTH  25
  2579.      Cursor  24                                LOWER  25
  2580.      Directory  17                             MIDSTRING  25
  2581.      Disk capacity  17                         NORMAL  25
  2582.      Disk free space  17                       PROMPT  26
  2583.      DOS errorlevel  25                        READKEY  26
  2584.      DOS search path  19                       READSTR  26
  2585.      DOSERROR  11, 13                          READUPKEY  27
  2586.      Environment variable  18                  READYN  27
  2587.      ERRORLEVEL  11, 13, 25                    REVERSE  27
  2588.      External command  12, 34                  SETENV  27
  2589.      Field length                              SETPATH  28
  2590.            maximum  26, 28                     SETVAR  28
  2591.      File exists  18                           SUBTRACT  28
  2592.      Frame  20                                 UPPER  28
  2593.      Installation  7                           VARIABLE  28
  2594.      Interior of a box  22                     WAIT  29
  2595.      Introduction  1                           WRITE  29
  2596.      Line numbers  36                          WRITEAT  29
  2597.      Literals  10, 11                          WRITELINE  30
  2598.      Pause  29                              POWERMAK  9
  2599.      POWERBAT.ERR  33                       Registration  1
  2600.      PowerBatch Commands  10                Registration Fees  3
  2601.            ?COLOR  16                       Removing PowerBatch From Your
  2602.            ?CURRDIR  16                           System  35
  2603.            ?DATE  16                        Screen clear  21
  2604.            ?DIREXIST  17                    Shareware  1
  2605.            ?DISKSPACE  17                   Software Support  4
  2606.            ?DRIVEEXIST  18                  String length  25
  2607.            ?ENVSTR  18                      Substring  25
  2608.            ?FILEEXIST  18                   System speaker  19
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.             Page 48                     PowerBatch                     Page 48
  2617.  
  2618.      Valid drive  18
  2619.      Value
  2620.            initial  28
  2621.      Variable  10
  2622.            value  28
  2623.      Variable map  9
  2624.      Warranty  2
  2625.      What You Get  3
  2626.